Will spreading your servers load not just consume more recourses
Posted
by Saif Bechan
on Server Fault
See other posts from Server Fault
or by Saif Bechan
Published on 2010-04-02T07:58:04Z
Indexed on
2010/04/02
8:03 UTC
Read the original article
Hit count: 244
I am running a heavy real-time updating website. The amount of recourses needed per user are quite high, ill give you an example.
Setup
Every visit
The application is php/mysql so on every visit static and dynamic content is loaded.
Recourses: apache,php,mysql
Every second (no more than a second will just be too long)
The website needs to be updated real-time so every second there is an ajax call thats updates the website.
Recourses: jQuery,apache,php,mysql
Avarage spending for single user (spending one minute and visited 3 pages)
- Apache: +/- 63 requests / responsess serving static and dynamic content (img,css,js,html)
- php: +/- 63 requests / responses
- mysql: +/- 63 requests / responses
- jquery: +/- 60 requests / responses
Optimization
I want to optimize this process, but I think that maybe it would be just the same in the end.
Before implementing and testing (which will take weeks) I wanted to have some second opinions from you guys.
Every visit
I want to start off with having nginx in the front and work as a proxy to deliver the static content.
Recources:
- Dynamic: apache,php,mysql
- Static: nginx
This will spread the load on apache a lot.
Every Second
For the script that loads every second I want to set up Node.js server side javascript with nginx in te front.
I want to set it up that jquery makes a request ones a minute, and node.js streams the data to the client every second.
Recources: jQuery,nginx,node.js,mysql
Avarage spending for single user (spending one minute and visited 3 pages)
- Nginx: 4 requests / responsess serving mostly static conetent(img,css,js)
- Apache: 3 requests only the pages
- php: 3 requests only the pages
- node.js: 1 request / 60 responses
- jquery: 1 request / 60 responses
- mysql: 63 requests / responses
Optimization
As you can see in the optimisation the load from Apache and PHP are lifted and places on nginx and node.js. These are known for there light footprint and good performance.
But I am having my doubts, because there are still 2 programs extra loaded in the memory and they consume cpu.
So it it better to have less programs that do the job, or more. Before I am going to spend a lot of time setting this up I would like to know if it will be worth the while.
© Server Fault or respective owner