Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Apologies for the inexpertly phrased question. I'm not quite sure how to put it.

My Linux server:

  1. Serves web pages to users
  2. Does lots of data processing and gathering in the background

I'd love for (2) not to slow down (1) - for them to be separate somehow. The best way I have found so far is to have both nginx and apache on the server. I have nginx serving the web pages and apache doing the data crunching. I then use CPULIMIT to limit my apache processes to 20% cpu. This keeps them in check somewhat. However, mysql becomes a bottleneck and generally it's a bit messy.

What's standard practice here?

Thanks!

share|improve this question
3  
Generally, data processing should be done on a different box...but that depends on what you're crunching. –  Nathan C Jul 25 '13 at 12:04
    
But don't you get the same problem with the database server being the bottleneck? Both boxes are dealing with data from the same server. Or do you have 2 copies of the database and sync them periodically? –  rastaboym Jul 25 '13 at 13:41
add comment

1 Answer

As Nathan said, normally you'd separate all of this. If the infrastructure is missing try to increase the priority of your nginx workers: worker_priority

-19 should be a good nice value for your workers. Limiting your Apache to 20% means, that it can never utilize more, even if your nginx is in idle. So using nice should be a much better approach. Basically you tell your OS that this thread always has priority over anything else, but if nginx is idle all the energy is given to your Apache.

Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.