Forum Moderators: phranque
At times server response on a shared server seems slugish. The first time I visit my site it takes maybe 8 seconds to load. Then all subsequent requests are nearly immediate. This is not a bandwidth problem, the pages are relatively small - 25k including css file of 5k.
When I look at my log files, traffic seem to come in streams. No traffic for 10 minutes, then a flurry of visitors finding the site with a variety of queries.
I'm thinking that the server is clearing the site from cache, so the first request is slow. After that response time improves. I am wondering if potential visitors are impatient until someone waits long enough to kick up the server again. Then I see "normal" traffic.
Am I dreaming on this one? The site is php with mysql on apache. I was wondering if stepping up to VPS would be worth it.
I don't have a direct answer to this question, but I do have an experience that may prove informational to you. When I first started serving a php/mysql driven site, I was on a shared DB server, which is standard procedure, unless you are on a dedicated box.
The dynamic portion of my site was *often* slowed and sometimes even timed out... after repeated complaints to my host (some of them more polite than others), I learned the problem was someone else on the box wrote a *greedy* interface... the host actually had to suspend their account until they fixed the coding... Needless to say I no longer host anything of importance with them, because it took nearly 3 weeks to clear up the issue.
I do not know if your entire (including homepage) site is served using a DB server, but this is worthy of having a look into either way if your site is slowing down.
Hope this helps.
Justin
Thanks for your response.
I've run apache on a Windows machine at home, but the set up is a little bit different than on a *nix box. I think my question is part apache, part *nix.
The entire site needs to come from the mysql database, including the home page. The mysql database is now around 3 megs in size (around 750 pages of content). I was wondering if the server was dumping the database after a short time and when the next request came in it had to put everything back into memory - making the first request slow but subsequent requests much faster.
basically, yes: the systems do internal cacheing.
The Unix OS caches filesystem disk I/O (e.g. the file holding your DB tablespace), and other sub-systems like databases normally have own buffer pools inside their address space as an internal cacheing mechanism to have those often used records or tables ready for faster access.
Since some ISPs tend to overload their servers, this cacheing stuff has its limitations and does not help, if there is too much demand but not enough supply: to get your data into cache/memory, someone's other data has to be kicked out, and vice versa. If the box is really overloaded, paging and swapping may add extremely to the sluggyness. Imagine what happens, if memory resources get so tight, that most active apache processes dominate and lesser used memory pages of the database system get swapped out.
Response times of 8 sec for a small page is far too much and will drive visitors away.
You may help your hoster to lessen the overall server load by saying good-bye and moving away your site elsewhere.
Regards,
R.
The mysql database is now around 3 megs in size
I have a site with a database of several hundred megs which serves 100% dynamic content to dozens of concurrent users. It is hosted on a shared server with no significant slowdown. It sounds as if your server is overloaded or that there is a rogue site which is hogging the resources. When you go to your control panel, there is uually a tatistics option which will give you details of server load.
Of course you do need to check your own scripts - you should look at gzipping your pages and caching your templates, for example.
Thanks for your response. The site generates enough income to justify and upgrade. I was thinking about VPS as a solution. The site really isn't big enough to justify a dedicated server. The VPS plan I am looking at guarantees resources (CPU and RAM). I think the box I'm sharing has 270 domains on it, the VPS plan is more in the 10 range.
encyclo -
I just went through a process of thinning out graphics and squeezing down my CSS file. I also use gzip and caching of pages.
So that brings me to my next research project - Moving a domain with no down time...
Thanks to all.