Web Software Architecture and Engineering – Life on the Bleeding Edge

As you guys may or may not know, there has been a lot of improvment in the web sphere in terms of performance tweaking and security. A lot of people have realized that its just not to good to have your web server be a first point of contact (after the firewall). That’s right. Your web server should NOT be serving the web. Sounds counter intuitive, right?
Well, allow me to explain. Web servers like IIS and Apache, as an example, have gotten too heavy and cumbersome. Ok, well – some of you guys are hard core fans of both servers. But they don’t scale very well. That is why you see people moving to lighter weight web servers like Resin (and many others), or so specially built high performance web servers like Lighttpd. 
What’s needed is a server that can do a couple thing:

  • Handle traffic issues like the infamous C10K problem.
  • Reverse Proxy to my actual web server (or cluster). It should be the only thing touching my web server.
  • Work under minimal resources. I don’t want to spend $$$.

In fact, here is the official description: “Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Written by Igor Sysoev in 2005, Nginx now hosts nearly 6% (13M) of all domains worldwide. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Nginx is one of a handful of servers written to address the C10K problem. Unlike traditional servers, Nginx doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but most importantly, predictable amounts of memory under load. Even if you don’t expect to handle thousands of simultaneous requests, you can still benefit from Nginx’s high-performance and small memory footprint. Nginx scales in all directions: from the smallest VPS all the way up to clusters of servers. Nginx powers several high-visibility sites, such as WordPress, Hulu, Github, Ohloh, SourceForge and TorrentReactor.”
This solves a couple issues. One being that your web server isn’t directly hit by outside traffic. Traffic goes from the firewall to this server, which can then do a couple things. It can scruitinize the request, do re-writing, caching, handle sending files, block bad requests, etc. All those things you didn’t want your primary web server to do!
That’s where NGINX comes in. NGINX currently handles 6% of all sites on the net. Its the web server you never heard of, and you better get to know. People building high performance sites in Ruby on Rails have started to use NGINX to boost perfomance. For more details, see http://www.modrails.com/. Yes, they are overcoming those infamous RoR hurdles with free and easy solutions! So should you!
There are a couple of things you need to know.

  1. One, if you are running Windows, NGINX doesn’t explicitly support Windows services. But fear no more, the first and only resource for setting up NGINX on Windows as a service comes from a fellow CF developer! And it works like a charm. Read more @ http://misterdai.wordpress.com/2009/10/16/nginx-windows-service/.
  2. Second, NGINX runs a site like WordPress. That’s right, check the WordPress.com HTTP Response Headers. Or see this site! That’s right, my blog! If you need to sell making this change to management, then that should get you started on the right foot.
  3. NGINX was developed originally for some Russian sites, and most documentation is in Russian. However, there is a new Wiki with tons of docs and an active forum in English. NGINX is being actively developed. More info @ http://wiki.nginx.org/Main.
  4. For some more details on using NGINX with ColdFusion, see this blog post @ http://coldfusion.tcs.de/nginx-and-coldfusion-using-nginx-as-a-reverse-proxy-for-more-performance.

Basically, my job is to get your minds whirling again. No ColdFusion is NOT dead, its just we as a community need to step up and take it to the next level. Imagine is MySpace has been built with ColdFusion, and instead if adding servers upon servers and including .NET, they had this option? Do you currently have load issues? What can NGINX do for you?
For more details go to:

People have been using NGINX in front of their mail servers (like Exchange), and for all sorts of other purposes. I’m investigating NGINX, Varnish, and other Web Application Firewalls to formulate what could become an awesome front-end for ColdFusion!

Advertisements

Comments on: "NGINX HTTP Web Server – Take CF to the Next Level" (9)

  1. Funny you should mention that. I was just learning about nginx last week. 🙂 Unfortunately, I work with a group that believes “If it doesn’t cost thousands of dollars and it doesn’t come with a $$$ annual support contract…it’s not worth our time.”

  2. Jake,

    Boy, I’d love to work with a group like that. 😛

    Unfortunately (or fortunately/depends on how you look at it), I’ve always worked in groups with limited budgets and resources, and that has always driven the requirement to find what’s low cost, and gives us the best bang.

    We’ve never had the luxury to think about support contracts!

    Whatever we add to our portfolio, we have to master.

  3. In my opinion, you’re better off that way. We are constantly waiting in hold queues, hoping for quick email reponses, etc. Any little thing that goes wrong and we have to run to the vendor and hope they’ll have a fix. It’s very frustrating at times.

  4. Garrett Johnson said:

    Nginx is a pretty sick little web server. I just set one up a few days ago for a ruby project. The one thing that does make it fast, can also make it bit frustrating… As far as I understand, there is no dynamic module loading like you do in Apache, so when you need to include modules like ssl, proxy, mod_rails, etc. you actually compile them all together when you build nginx. This does give it a very nice performance boost, but its good to remember if you ever needed to add a new module for some reason, you will have to take down the entire web server and build it again.

  5. David Boyer said:

    @Sami

    You might be interested in running ColdFusion under Tomcat instead of JRun. Once it’s set up correctly you can connect Nginx straight to ColdFusion and skip the need for an extra web service.

    http://wiki.nginx.org/NginxJavaServers

  6. David,

    Are you saying to simply replace JRun with Tomcat? How would that skip the need for an extra web service? ARe you saying basically you can tweak the setup further to have Tomcat skip all static files and have NGINX do that, while leaving Tomcat to work with CF to server cfm files?

  7. David Boyer said:

    I’m going from the approach that if you didn’t have ColdFusion installed in Multi-server mode and it’s relying on IIS (isapi modules) / Apache (mod_jrun). With that setup you actually have Nginx > Apache | IIS > Jrun > ColdFusion.

    If you install CF in multi server mode, produce a WAR and use it in tomcat you can easily skip the Apache/IIS service. Nginx (serves static and proxies cfm/cfc onwards) > Tomcat > ColdFusion

  8. David,

    Definitely makes sense. Will have to try it out!

  9. Matt Shields said:

    Sami,
    I saw your comment on my blog. Quite a while ago I wrote up an example of how to use Nginx as a frontend Proxy for ColdFusion.

    http://www.sysadminvalley.com/2009/10/01/using-nginx-web-server-with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: