Jump to content


Member Since 18 Oct 2009
Offline Last Active May 05 2016 06:46 PM

Topics I've Started

Planned awesome web server stack

18 August 2011 - 02:25 AM

Alright, so, if you've read the previous two threads in this forum, you'll know that I'm planning on setting up a web server from scratch on a VPS. In this post, I'm going to detail the process I plan to use and possibly some tips/tricks that will help others along the way. Now, onto the good stuff ;)

After much research and option weighing, I have come to the conclusion that I will be using Apache + PHP fgci behind Nginx. Now, before everyone gets into an uproar as to why I just didn't opt all for Nginx, I'll explain why:
  • Running Apache behind Nginx will allow me to retain mod_rewrite capabilities, so that I don't have to deal with rewriting the rules specifically for Nginx.
  • Using Apache + PHP fcgi over mod_php was decided because of the lower memory footprint which is vital is pretty much any server environment. Using fcgi does have its downsides though; I will be unable to set PHP directives from the htaccess file as I have grown used to over the years. This means that I will have to come up with a PHP configuration that kicks butt and works well for my combination of mostly WordPress and Drupal powered sites.
  • Much faster page load times; duh!
  • Applications will see that they are being run from Apache, which is good because some web apps might disable certain functions if they detect they are being run on different server software.
All in all, I think I've come up with a winning combination; I've added awesome page load times but really only lost functionality that was negligible to begin with (setting PHP directives from .htaccess). I felt that if I went all Nginx, I would be adding complexities that, quite frankly, I didn't know/want to deal with with the only benefit of *maybe* getting slightly better load times and less memory usage. Another high performance web server that I looked at was Cherokee. Cherokee is probably just as fast and lightweight as Nginx (don't quote me on that :P) and also includes an awesome web interface to configure the server. Unfortunately, like Nginx, Cherokee does not have mod_rewrite compatibility and again, I'm not going to run mission critical web server software that I don't know how to fully work in case something were to go wrong. All of the above also applies to lighttpd.

Now, onto the database layer in that juicy web stack. I will being running Percona just because I have yet to see an argument yet about why I shouldn't run it. In the WHT forums, a guy said that I probably will not notice the difference between Percona and MySQL for the size of my server. Keeping in mind that memory is king, I wanted something like Nginx that could handle connections consistently even when put under a lot of stress. It is possible to optimize MySQL to use less memory by more or less following the "my-small" config to reduce the memory footprint and such. However, this does not address the issue that the InnoDB storage engine simply cannot handle as many transactions as the XtraDB engine can.

OK, so the big stuff is out of the way now but there are still more things I can do to optimize my setup. First thing is some sort of caching mechanism. While I haven't looked into caching and Nginx I do have experience with Apache, PHP, and XCache and let me tell you, XCache is truly amazing. For those of you who don't know, XCache is a PHP opcode cacher made by the same folks who make lighttpd. I never really thought much of of XCache until I installed it on my buddy's server and let me just share some of the statistics:
  • 480.07Kb file reduced to 69.63Kb
  • 30.70Kb file reduced to 3.03Kb
  • 5.35Kb file reduced to 637.00b (that's bytes folks)
On average, with the current configuration, XCache has approximately 120 files cached at any one time. But I must warn you: XCache was not easy to configure. Not the syntax, but the "best" settings. It took me a while to figure out the settings which worked best and it's going to be different for each server. For example, in the beginning my OOMs (out of object memory) were going through the roof and I just had to play with the setting to keep the number as low as I could. Another issue I ran into was the memory filling up right away which is also no bueno. For those of you really curious, I've uploaded a screenshot of the XCache overview page to see my config and the general "stats". To those of you now wanting to use XCache: I strongly urge you to build it yourself as I couldn't find any up to date repos and building it was super simple; just follow the instructions.

The second step you can take to speed up your server is CloudFlare which you can easily opt into here at MDDHosting through your CPanel (w00t!). Not only does it do an awesome job at caching files but it also functions as your DNS server which is just another load off of your machine. There's not much to say about CloudFlare except to just use it!

Sorry about the writing slowly turning to crap from top to bottom (quite tired as I write this) but hopefully, you get my general gist. Hopefully, I'll get this thing running on a sandbox server in the next few days and present even more findings! Also, I'll be running Ubuntu server 11.10 (the latest) with dropbear for the SSH server as it uses less memory than OpenSSH. Yay less memory usage!

Thoughts and questions about Apache, Nginx, and Percona

08 August 2011 - 03:30 AM

Seeing as I am leaving the comfy shared hosting world soon for a new home in an unmanaged vps, I am in need of as much advice, information, and practice as I can get.

I've been reading up a lot on performance of web servers, http accelerators, reverse proxy caches and the like and already, I feel a little overwhelmed. As I understand it, Apache by itself is a poor choice for wanting to serve up websites with a low memory footprint due to the fact that: A) each new process that Apache spawns, it uses up more memory and each connection spawns a new process and B) due in part to this, Apache is easily the least efficient static file server. And a sidenote on MySQL: Percona seems to be the best choice in terms of a drop-in replacement for MySQL. This is due in part to Percona's database storage engine called XtraDB whose performance far outperforms InnoDB and also scales much more efficiently. Also, the Percona server with the XtraDB engine uses less memory than MySQL.

I will soon be practicing configuring a mock server I've set up at home and I have a few questions for anyone who is willing to help out (I would greatly appreciate it):
  • If I run Apache + mod_php behind Nginx, will .htaccess files be handled as they would be if Apache were the only web server running? If so, can PHP directives be set from the htaccess file then as well as mod_rewrite rules?
  • Logs. How should I deal with them? I feel like if I ignore them, they'll grow to ridiculous sizes and slow down the server dues to the the fact that it's harder to deal with text files in the tens of hundreds of mb area.
  • Has anyone had any experience with the Percona server/XtraDB storage engine? Issues with it? Any reason why I should opt for MySQL over Percona?
  • DNS servers. Should I get a third party to deal with nameserver/dns stuff or should I just bite the bullet and run my own (I have literally no experience with DNS servers)? I know BIND is the most popular followed by (if I'm not mistaken) PowerDNS. Does anyone have an opinion about which one I should be running?
  • Email servers. I haven't looked into a comparison of email servers as much as the web servers, but I would like to know if anyone has preferences on mail servers.
  • Operating system? I will be using Debian as I have the most experience on that unless someone is willing to make a case for another OS I should use.
That should be about it. Again, I would greatly appreciate any help given here. Thank you so much!

Leaving MDDHosting in ~2.5 months :(

02 August 2011 - 01:59 PM

I'll try to make this short and sweet:
Well, my next billing cycle is in sight and unfortunately, my services will not be getting renewed. It pains me to do this, but alas my time in the shared hosting world has come to an end. The next leg of my web hosting journey carries me into the world of low-end VMs as I crave more control and expand my knowledge of Linux servers while remaining on a small budget. As such, as much as I wish MDD had these types of sub $10 VMs, I must move my patronage elsewhere. But I cannot think of a better company (hosting or otherwise) who has better staff, support, personality, and attitude than MDDHosting. From giving straight-up, uncensored information to it's customers through tough times with servers to a nonchalant company Twitter account and informative blog by the owner, MDDHosting has gone well above and beyond the call of duty for a web host. In the end, the customer is always the bottom line, and MDDHosting, in my opinion, always did whatever they could to keep them happy. I can only hope the next hosting company I buy service from has 1/10th of the greatness and values MDDHosting has. My time at MDD has been outstanding and I will always be grateful to the community for all of their help and expertise. If Mike allows it, I would love to continue offering help and advice on the shared hosting forums.

All the best luck to Mike and the rest of the awesome MDDHosting crew!

Thoughts on Mailman v3

13 July 2011 - 02:10 PM

Although I don't use Mailman myself, I have a friend who needs the functionality that it offers, so this is sort of my first real exposure to it (read: no flaming on the n00b Posted Image). As I'm sure most people who use Mailman v2 right now are aware; the design of it is quite clunky, not very aesthetically pleasing, and has a steep learning curve. I took a walk around their wiki yesterday and saw mentions of v3 (in the making for quite sometime now [2006?]. I apologize if I'm completely out of the loop here) so I decided to see what kind of changes were going into said version. And I'm not going to lie; the new/planned interface is sick. It's at least 50x better than v2. I guess there's going to be many new features as well. I'll list some of the ones that seem coolest to me:
  • Obviously, the new interface
  • Better archival features (including theming)
  • RSS feeds
  • RESTful API (I saw this on the site somewhere, but I'm not sure if it will even be included in v3. Seemed almost like a prof-of-concept when I was reading the entry on it.)
Your thoughts on Mailman v3? I think it's going to be pretty legit. Hopefully, it gets released soon!

Image handling broken in Drupal 7 running PHP 53

03 June 2011 - 01:39 PM

Not really the biggest of issues but an issue nonetheless i suppose.

So I recently installed Drupal 7 and attempted to add some images but received some fatal errors. Like:

Warning: imagecreatefromjpeg(): 'public://Jellyfish.jpg' is not a valid JPEG file in image_gd_load() (line 237 of/home/happyplace/public_html/somesite.org/modules/system/image.gd.inc)
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: in image_gd_load() (line 237 of/home/happyplace/public_html/somesite.org/modules/system/image.gd.inc)

Okay, so maybe the Drupal code is broken. So I tried switching over to ImageMagick for processing. Same type of errors are happening ("unable to generate the derived image" most likely similar to the invalid JPEG error from earlier). At this point, I get the feeling it may not be Drupal's fault.

*Throw hands up in air*

Then I get the idea to switch the Drupal install over to PHP 52 (it was running 53) and lo and behold, everything is working! So I'm thinking maybe the PHP 53 binary or image modules were compiled incorrectly? Who knows...

Just thought I'd put that out there. Not a big deal, but PHP 53 does have better performance and I would prefer to use it.

Also, feel free to answer my poll! Just a little something I thought would be a good idea. Not for school or official research or anything.