Post subject: Defrag, e-mails and php acceleration Posted: Wed Aug 26, 2009 12:44 pm
Joined Fri Aug 18, 2006 11:47 am
Location Merseyside, United Kingdom
Favourite OS Microsoft Windows 7 Ultimate x64
Long time since I did a blog post. I guess life is just so busy I don't have the time.
I'd like to take the time to explain some recent problems that have been going on server wise.
Defragmenting: As you all know I decided it might be a good idea to defrag the server's hard disks. When I did a preliminary analysis the drives looked awful. Both disks had around 80% fragmentation. No wonder the server seemed to run so slowly! I decided to find a decent defrag program that would put the files in order in a smart enough way that boot files would be together, and the betas together, etc. With the help of mrpijey I found a program called "PerfectDisk10" which was perfect for the job.
I started defragging, but it was painfully slow. It took almost a week to complete, but in the end the performance of the drive was up by 90%! I think it was a choice well made, even if it did cause a server wide slow down for a week. I have now scheduled a defrag on a daily basis at 5am, the lowest traffic and lowest hit time of the day, and after all the backups have run. I have done the same on my own home server too, since the disks on that looked just as awful. The performance increase was incredible.
E-mails: Doesn't everyone just hate it when things stop working for what appears to be no reason at all? I certainly do. Well that's exactly what happened to the forum e-mail just a few days ago. For some reason all e-mails from the forum stopped working. I could send e-mail from my client and receive them just fine, but the forum wouldn't. The error logs for phpBB3 showed an error connecting to the SMTP server, which I thought odd since it connects via localhost. I went in and checked all the mail settings, but everything looked correct. My next course of action was to check the ban-list on the server, so see if for some reason it was auto-banned. Nothing there. I was stumped.
I decided to try the hMailServer forums (the e-mail server software) for some help. I spent over an hour searching the forum, and trying various things such as disabling the firewall, anti-virus, restarting the server itself, everything short of reinstalling the software. Still nothing. OK, backup the database and e-mails, and reinstall the server. Still nothing!
I decided to consult the hMailServer logs for some more information. The logs claim that it could not read the file, but didn't state why and this only happened from connections made from the server to the server, and by the forum. I tried a contact form on another website, and that e-mail got through instantly. Strange. It was time to make a post on the forum and find out what its members could have to offer. Thankfully, its developer was roaming the forums at the time and offered his help.
Over 50 posts later and over 24 hours of trying just about everything I could think of, I changed one last option in phpBB's e-mail settings.
E-mail package size: This is the number of maximum e-mails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification e-mails.
This value was set to 10, and had never been changed for as long as I can remember. I decided to take the advice of what was written there, and changed it to 0. Suddenly the forum started sending e-mails perfectly again!? I couldn't understand it. I posted on the hMailServer forum what I did and the developer had a go at me for saying it was all hMailServers fault. Admittedly I blamed hMailServer because nothing on the website side or forum had been changed in over a year, so how it could be at fault is beyond me. However, it was, and now the problem was solved.
I apologised to the developer for blaming his software, and he accepted that apology. He said that "anyone who blames hMailServer for their problems like this is doomed to fail". I agree. However I still don't understand what went wrong. All I care about now is that it is all working again.
PHP Acceleration: This is something I should have added a long long time ago but never thought it would do much good. A certain member, "monkey56657", was doing some tests to the server without my knowledge to see how many connections it could cope with after he received a few Error 500's when loading pages. The server can't even cope with 10req/sec without falling over at the moment. He contacted me on MSN and we had a chat, to which it was revealed to him that the server did not use any form of PHP acceleration. He found it crazy that any admin like myself wouldn't use acceleration to make loading quicker. I didn't want to add this acceleration because the guide to installing it was awful, however I persisted and installed the package.
Instantly I saw an increase in speed from 1.7sec/page load times to 0.6sec/page load times. I couldn't believe that it could make such a difference. The way it works is that it "compiles" the PHP script rather than interpreting the code every time you run a page. This makes it faster for PHP to process the script because it doesn't have to internally compile it each time before running it. Simple, but effective solution. It also cuts down slightly on CPU load, potentially allowing more reqs/sec, but so far its made no difference to that end. I'm still working on a solution for that.
So there you have it, some basic steps to make the server faster makes a huge difference. As for fixing things, well, its all in the life of an admin
Post subject: Re: Defrag, e-mails and php acceleration Posted: Fri Aug 28, 2009 3:08 am
Amateur Beta Collector
Joined Wed Feb 13, 2008 7:20 pm
Location Where The Streets Have No Name
Favourite OS Windows 7
Your hard work definitely shows, Andy. The forum is running really smooth and the FTP speeds for me have, in fact, been a bit faster since the defrag. Pretty strange you had to change that value for the emails from 10 to 0 though...
Post subject: Re: Defrag, e-mails and php acceleration Posted: Fri Aug 28, 2009 4:50 am
Guru Beta Collector
Joined Tue Jan 30, 2007 5:45 am
Location New Zealand / My PC
Favourite OS Windows 8 64bit 9200
Yeah without Andy we wouln't have BA or we would have somthing simular but it would be a pos that lagged and had more adverts than actual content on each page. (Why I haven't used cheat planet for like 2 years.)
_________________ PC Gamer and hardware plus software enthusiast (especially betas).