Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a program (Node.js web application on Ubuntu) that loads in about 7 seconds on my home computer.

Recently I copied it to a VPS, and there, it loads in 15-30 seconds.

I am trying to find out why it is so slow, and how I can make it faster.

I started with checking the memory consumption, but found out (using "top") that on the VPS I use only about 400 MB out of 2 GB. So, increasing the memory is probably not the solution.

On the other hand, during startup, I found out that CPU usage is 100%, so I thought maybe the problem is with the processor. So I compared the processor types, but, the difference does not seem to be that large.

Here is what I get from "cat /proc/cpuinfo" on my home computer:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 42
model name  : Intel(R) Pentium(R) CPU G620 @ 2.60GHz
stepping    : 7
microcode   : 0x14
cpu MHz     : 1600.000
cache size  : 3072 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips    : 5188.24
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 42
model name  : Intel(R) Pentium(R) CPU G620 @ 2.60GHz
stepping    : 7
microcode   : 0x14
cpu MHz     : 1600.000
cache size  : 3072 KB
physical id : 0
siblings    : 2
core id     : 1
cpu cores   : 2
apicid      : 2
initial apicid  : 2
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips    : 5187.97
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

And here is the result of "cat /proc/cpuinfo" on the VPS:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 44
model name  : Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz
stepping    : 2
cpu MHz     : 2394.153
cache size  : 12288 KB
physical id : 1
siblings    : 8
core id     : 0
cpu cores   : 4
apicid      : 32
initial apicid  : 32
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid
bogomips    : 4788.30
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

(this is only the first processor - I have a total of 11 identical processors on my VPS, but this is not relevant because any single thread will need to do the same initialization).

My home computer is 2600 GHz, and the VPS computer is 2400 GHz. Does that justify a difference of 100-300% in run time?

More importantly: what can I do to make my program run faster on the VPS?

share|improve this question
    
There's a reason Sandy Bridge replaced Nehalem. Westmere is just a die shrink of Nehalem. –  David Schwartz Oct 2 '13 at 12:55
    
@DavidSchwartz What? Can you please explain? –  Erel Segal-Halevi Oct 2 '13 at 12:59
2  
The VPS uses a processor with an older microarchitecture. You can't compare clock speeds across different microarchitecures. There's no reason to expect the performance measurements to be directly comparable because the CPU architectures are different. You say: "My home computer is 2600 GHz, and the VPS computer is 2400 GHz. Does that justify a difference of 100-300% in run time?" This is like saying "My car has a 12 gallon gas tank and my truck has a 14 gallon gas tank. Does that justify a difference of 1,000 pounds in towing capacity?" –  David Schwartz Oct 2 '13 at 13:02
    
@DavidSchwartz You mean that "Pentium G620" might be substantially faster than "Xeon E5620"? So, if I find a VPS with Pentium G620 (or better) CPU, I can expect the performance to be comparable to what I get in my PC? –  Erel Segal-Halevi Oct 2 '13 at 13:05
    
Not exactly. I'm saying that you can't compare them directly. You have to look at what the program is making the CPU do. –  David Schwartz Oct 2 '13 at 13:15

1 Answer 1

The very definition of a VPS answers your question:

It's a virtual private server. You share the hardware with others.

(You just can't see them, depending on the setup).

And naturally, it's in the interest of the VPS' provider to load the system to a certain extent, in order to increase their profit margin.

share|improve this answer
    
So, what can I do to improve the speed? I thought of buying more CPUs, but, currently I already pay for 11 CPUs, and I only use one (my program is single-threaded). –  Erel Segal-Halevi Oct 2 '13 at 9:17
1  
System-wise, you can't do a lot judging by your description. The culprit is most likely somewhere in your application: a) it requires a lot of CPU, and b) it only runs single-threaded. Both require changes to your app - for which Stackoverflow is the better, if not ideal place to ask. –  Roman Oct 2 '13 at 10:52
    
The exact same application runs 2-4 times slower on the VPS, than on my home machine. So, the problem must be in the server - not the application... –  Erel Segal-Halevi Oct 2 '13 at 12:19
    
Sorry, I misread some things. Still, the only thing you can do use a dedicated, physical server (where you also have some control over what HW you get) or optimize your app. –  Roman Oct 2 '13 at 12:45
    
@ErelSegalHalevi That doesn't follow at all. The exact same person may be able to drive an automatic perfectly but may have huge problems driving a stick shift. That doesn't mean the problem is the car. –  David Schwartz Oct 2 '13 at 12:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.