Cherokee Web Server To The Rescue!

Cherokee Web ServerWhen TechMiso first launched the site was operating on a special Joyent Accelerator with minimal specifications. The site quickly outgrew the nominal features set so we migrated to a 256 slice at SliceHost, one of the best virtual service providers today. Although a superior provider, we immediately started experiencing problems with Apache due to it eating more RAM than available. Cherokee web server came to the rescue and solved all our problems, world peace to follow.

I first want to take the time to thanks the few folks who responded to my cries for help. Oli offered a lot of good information and ultimately provided the advice we ended up following: forego Apache in place of the lean mean web serving machine known as Cherokee.

It would have been easy to simply upgrade from the 256 to 512 slice to solve our problems. But since TechMiso is run by geeks, why take the easy way out? More importantly, why bother to spend more money than necessary? There is absolutely no reason why TechMiso cannot properly function on 256MB of RAM.

After tweaking Apache until I was blue in the face I was ready to give up. Nothing I did was working, even though I followed just about every piece of advice offered on the Internet. Not only did I tweak Apache, but I also tweaked MySQL and other services running on our box. Make as much RAM available to Apache so it would stop consuming more resources than available.

But alas it was not meant to be. Cherokee web server to the rescue. Cherokee bills itself as the following:

Cherokee is a high-performance web server. It is very fast, flexible and easy to configure. In fact, it is the fastest web server there is. Check out the benchmarks and see for yourself. It offers support for the widespread technologies nowadays: FastCGI, SCGI, PHP, CGI, SSI, TLS and SSL encrypted connections, Virtual hosts, Authentication, on the fly encoding, Load Balancing, Apache compatible log files, Data Base Balancer, downtime-free updates and upgrades, Reverse HTTP Proxy, and much more.

It is highly efficient, extremely lightweight and provides rock solid stability.

Cherokee is definitely, without a doubt efficient and extremely lightweight. Since migrating from Apache to Cherokee about 36 hours ago TechMiso has no longer experienced lockups. This is important for two reasons: the site remains up without issue and there is no longer a need to hard reboot the server once all the available RAM is consumed.

There are a few important differences in memory usage I have immediately noticed since our migration to Cherokee.

  1. The amount of available RAM has increased dramatically. Cherokee uses a minimal amount of memory and rarely exceeds more then a negligible few megs. Contrast that to Apache consuming RAM like it grows on trees.
  2. The use of swap has become almost non-existent. Since Cherokee is so lightweight it does not need to force the OS to start using swap space in place of physical RAM. This has the dual effect of ensuring the site stays speedy while resource consumption remains low. Most important – the site no longer locks up and becomes inaccessible due to the constant swap use.

The one caveat to using Cherokee is that since it is not Apache it will not work with mod_php. Instead it must use fastcgi, which essentially executes PHP on the command-line in the background. In most tests fastcgi has been slower than mod_php in parsing PHP. But for sites not doing anything fancy, like TechMiso, the speed difference is unnoticeable.

Cherokee Admin - StatusOutside of Cherokee being a wickedly speedy, lean and lightweight web server, the best part is the manner in which it can be administered. Cherokee offers two options for its configuration – modify easy to understand text files similar to how Apache is configured. Or use the user-friendly cherokee-admin interface.

Cherokee Admin - Virtual ServersCherokee-admin is capable of configuring just about every aspect of Cherokee but from a sexy web-based interface. If you are afraid of text files, or like us – new to Cherokee – then this is a lifesaver. Like the server itself, the admin GUI is lean, lightweight and very simple, hiding a boatload of power behind its sexy interface.

Installing Cherokee was just as easy as installing any other Ubuntu package. I plan to write-up a quick HOWTO sometime this week for those interested in taking the same plunge TechMiso took. It is well worth it!

Cherokee literally rescued TechMiso from some hard times. A free download, Cherokee ended up saving us money in the longrun. Rather than having to upgrade our 256 slice to a 512 slice, Cherokee rescued our resource consumption and saved us $18/mo since we did not need to upgrade the slice. Not bad for a free product, right?

If you ever get the opportunity, I strongly encourage you to look over Cherokee. It does exactly what it is designed to do and does it very well. Regardless of the savings it offered TechMiso, the project is one of those lil gems in the internet sea. Give it a shot and you may find that it ends up rescuing you one day too.

  • YorickPeterse

    I wonder how many visitors you're getting if 256MB of RAM isn't enough :P

  • Ryan

    What are some of the pros and cons of Cherokee in comparison to, let's say, SquareSpace?

  • http://techmiso.com Scott Jarkoff

    Comparing SquareSpace to Cherokee is like comparing Apples to Oranges. They are two completely separate types of products. SquareSpace is probably a closer equivalent to WordPress whereas Cherokee is like Apache, Lighttpd or Nginx.

  • http://techmiso.com Scott Jarkoff

    Not so much that as it is Apache consuming ram like there's no tomorrow. For a small site Apache is unnecessary. Maybe when we need to do fancy stuff then we'll upgrade ram and use Apache. Until then its Cherokee all the way.

  • YorickPeterse

    But doesn't using a different type of server, in this case Cherokee, kill some of Apache's functions, such as mod_rewrite ?

  • http://techmiso.com Scott Jarkoff

    Obviously you can no longer use Apache modules but much of the important functionality exists in Cherokee. As you can see we still have clean URLs here on TechMiso. That is performed using mod_rewrite on Apache, however on Cherokee there is a specific mechanism for performing the same functions.

    It is really good stuff. I'm quite pleased!

  • YorickPeterse

    Hm..Interesting. I took a look at their site and the benchmark results are pretty interesting.

  • http://techmiso.com Scott Jarkoff

    I am definitely impressed thus far. You should check it out and compare results to see if it's worthwhile.

  • YorickPeterse

    I probably will in a week or so, first need to find myself a cheap and decent machine that I can use as a server.

  • http://www.facebook.com/people/Michael-Smith/501474923 Michael Smith

    Thanks for the tip, Scott! I hadn't heard about Cherokee until now. I'll have to check out their site.

  • pierreg

    TrustLeap G-WAN is much faster than Cherokee, and:

    15x faster than Apache
    3.5x faster than Rock (webspec's 2008/2009 winner)
    4x faster than Microsoft IIS 7.0 and ASP.NET.
    400x faster than PHP, 200x faster than Python

    http://www.trustleap.ch/

  • chris

    What a load of bull. I have installed the latest version of Cherokee 99.39 on Ubuntu 9.10 and once installed it uses a massive amount of RAM from the get go. almost 400megs was what it is after a clean install and mysql being tweaked for performance. Compare that to apache and it is around 100megs. This appears to how it interfaces with Python.

  • http://twitter.com/YorickPeterse Yorick Peterse

    Depending on your configuration this can be caused by several factors. I tried Cherokee about a week ago and it hardly used any memory at all. Are you sure you are looking at the right memory information and not the memory info including cached items ?

  • SandraMillhouse

    Cherokee Web Server sounds like a real life saver. t surely ain't easy finding a reliable VPS hosting that can manage all the things a growing site needs. Lucky for you you were able to solve the Apache problem.

  • Kevin M

    If Apache was swapping did you lower the MaxClients setting?

  • http://techmiso.com Scott Jarkoff

    Indeed, but it did not solve the problem.

  • Skinkie

    …and you have to rewrite your entire app in C. Secondary G-WAN is itself is closed source while it uses libtcc (TCC, is LGPL licensed).

  • Skeptical

    Well, I tried it. And I will certainly stay with Apache.

    Cherokee is consuming a lot of memory and bangs the wall on the CPU as soon as it has to serve a few hundreds of clients -not even talking about the pain when you are using it with PHP (don't try this on a production server…).

    So much for the 'free' software that aims to 'conquer the Web'.

    You should work to fix Cherokee instead of boasting about its non-existent qualities and down-playing Apache.

  • Alligator

    I confirm the trouble with Cherokee. It's not ready for production.

    Actually, Cherokee is so “safe and reliable” that they have to reboot the cherokee-project.com server every month or so to keep it running:

    http://uptime.netcraft.com/up/graph?site=www.ch…

    Wow. That's really impressive because Apache.org is performing immensely better in this matter -despite more visitors:

    http://uptime.netcraft.com/up/graph?site=www.Ap…

    Come-on Cherokee cheerleaders, improve your publicly-subsidied product before saying stupid things.

  • Xiong Chiamiov

    Of course, the benchmarks were already old when you wrote this comment, and they're even older now. The newest ones are from October of 2008, and with a new release every week or two, a hell of a lot has changed since then.

  • Xiong Chiamiov

    Apache.org and cherokee-project.com run on the exact same server configuration, except with different webservers, amirite? >_>

    I'm not sure what graphs you're looking at, but I see 200-day uptimes between reboots.

    Aside from the fact that there are good reasons to reboot a server (kernel updates, hardware modification), there are a hell of a lot more things going on in a server than just the webserver, so it's rather foolish to assume that it is Cherokee that is causing any reboots. Besides, as long as you aren't locked out of the machine (which can happen if all the memory's consumed), you just kill off the offending processes, no reboot necessary.

    If you're going to troll, you might as well do a good job of it.

  • Neric

    Googling “cherokee vulnerabilities” returns 83,700 replies.

    Would you call Google a “troll” because it exposes Cherokee's holes?

    To gain in credibility, don't bash Apache and better check your own code.

  • Xiong Chiamiov

    lolwut?

    > Googling “cherokee vulnerabilities” returns 83,700 replies.
    >
    > Would you call Google a “troll” because it exposes Cherokee's holes?

    No, for a number of reasons:

    1. Google is not a person.
    2. You're the one bringing the search results into discussion.
    3. Mentioning vulnerabilities does not a troll make.

    I'm fairly certain that you'll agree with me on at least the 3rd point, as you are implying it in your comment. You also imply that there is some sort of parallel between mentions of vulnerabilities in Cherokee and reboot analysis of the Cherokee.org website.

    In addition, your first line is crafted to be misleading – the initial thought that flits through one's mind upon reading it is “Oh my god! Cherokee has 83,700 vulnerabilities?”. I present to you once again a list, this time of possible things that such a search will return:

    1. Exposure of a vulnerability in Cherokee (a bug report, for instance). It may or may not be fixed in the current release, but likely is, considering that Alvaro releases a new version every week or so.
    2. Discussion of a vulnerability.
    3. Mirrors of a discussion of a vulnerability.
    4. Questions asking if there are any vulnerabilities in Cherokee.
    5. Discussions about multiple webservers.
    6. Things not related to Cherokee the web server at all.

    From a quick glance at the Googles, it seems to me that old bugs, mirrors of discussions about them, and unrelated make up the bulk of the results. It's also worth noting that Google is known for having rather unreliable estimates of search result numbers.

    The reason I accused the GP of trolling was because he presented inaccurate facts to support an otherwise flawed premise, and did so in a forum where it was likely to heckle a large number of the visitors. You are in quite a similar situation.

    > To gain in credibility, don't bash Apache and better check your own code.

    I'm not sure what comment you read, but it sure as hell wasn't mine. I think Apache's a damn fine webserver, and I didn't say anything to the contrary.

    Oh, and what I think you meant to say was

    >To gain in credibility, don't bash Apache and learn how to configure Apache properly.

    as memory-hogging code is going to hog memory, no matter which webserver you use.