Hi,
I host my website on a vps server with 3GB of ram and 400mhz cpu divided on 16 cores.
Problem is that the site suffer from long and inconsistent time to first byte. Time to first bit can be anything between 1 second to 5 seconds.
My question is if this issue (inconsistency) is related to the vps provider or to server configuration. Thanks
More likely it is the actual application code itself (combined possibly with server configuration). Is the 400Mhz a typo? If not, matching that little CPU against 3GB of Ram seems to be quite unbalanced.
If you are running something like Wordpress then there are plugins that can help you track down the source of the problem. Otherwise tools like New Relic and Dynatrace are very helpful. Worst-case there's always old-school debugging techniques of instrumenting things to find the source of the problem.
You'll also want to check your apache stats (assuming it is apache) to see if you are running out of clients or file descriptors or any other finite resource.
If you're using a database you can turn on slow query logging to capture those but you may get more from instrumenting the app.
Oh, and for the record, even 1 second is pretty long for TTFB. I wouldn't be surprised if you could significantly reduce the variability as you improve that as well.
An interesting point is that even the static resources are quite variable and take a long time to serve. I'm not sure about the specific VPS you are on but in general it is quite possible to have stable and fast results on a VPS. It is also possible to have variable results on a good VPS depending on the application logic but in this case it looks like you have a server or web server configuration problem. The jpeg's for the skin should be coming back a lot faster than that.
Could still be a server configuration problem (if it is php, how the server calls php can be a big deal - module, cgi, fcgi, fpm - particularly when resources are constrained). I expect you'd be a lot better of with the same CPU power spread across significantly fewer cores.
Thanks for your reply and the info.
VPS is from server4you.
So the bottom line is that it could be both the server or the configuration? My problem is that my server management company tells me it's a server issue and my vps provider tells me it's a server optimization issue.
Thanks again for your help.
Is your application portable enough that you can try it on another server (with the same configuration)?
They are both probably right to some extent. The server isn't capable enough to run the site as-configured and the site isn't configured to run optimally on the server. My guess is that it will actually take a lot of tuning to make an application perform well when it is scaled across that many low-CPU threads.
Thank you very much.
I find it very strange they chose to spread the cpu power over so many cores. Wondering what would be the reason for them to do it. Anyhow, I asked them if it is possible to get the same power over 1 or 2 cores only.
I had the same configuration over a different vps at a different company with less memory and less cpu power and it is working fine.
Thanks again for your help.