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.

i am working on an web application that requires the page to be updated every second. You can think of a websites with stocks where the data has to be updated real time.

Background

For this real time update i use Ajax, the jquery plugin. My database is mysql with innoDB tables, and the application itself is written in php.

The Ajax script in the browser runs every second, this does only a read. To update the database with other values there is a cronjob that executes every minute, which executes a php script that runs every second. This scripts does reads and writes.

Further more the user does reads and writes. There is a lot going on.

Question

Now i am fairly new to this type of large applications, and some of the terms are confusing me quite a bit, and i don't know if my setup is wrong.

My setup right now is like this:

I have a dedicated server, with centos running and plesk parallel panels. The server is running apache, with php and mysql databases.

Now here is the list of things that are confusing me. I have read about these terms but i don't understand what they really do and how to benefit from them.

1) The first thing is lighttpd and ngingx. Are they http servers like apache, or are they something else. And if they are http server, are they easy to switch to from apache.

2) What is FastCGI and CGI. Are they like php, or are they something else. Are there any benefits over using PHP, and are they easy to switch to.

3) Last thing i want to know is something about static content delivery. If i want to deliver my static content from another domain do i need a separate server for that, or can i just configure that in PLESK.

Sorry for all the noob question guys, but i would really appreciate some help on these topics.

share|improve this question
    
Not related to your questions, but if the data is only going to change every 60 seconds, why bother querying every 1 second? Surely every 10 seconds would be OK? It will reduce the server load 10-fold, and the maximum latency would be 10 seconds. I don't know anything about trading stocks, but surely a 10 second lag isn't the end of the world? –  Mark Henderson Mar 11 '10 at 0:51
    
No the data can change every second. the cronjob runs a php script. And the php script runs every second during the minute. And also when user_x makes the data change by his input, it must be visible in real time by user_y –  Saif Bechan Mar 11 '10 at 0:59
    
Ah, ok, my apologies –  Mark Henderson Mar 11 '10 at 1:35

1 Answer 1

up vote 5 down vote accepted

lighttpd and ngingx

Correct, these are HTTP daemons that do the same job as Apache, but are generally geared to different kinds of content serving. I don't know much about them (I'm an Apache/IIS man myself), so I don't know why you would choose one over the other. I'm sure there's lots of questions on serverfault about why you would though.

For more information, try here or here or here or here or here.

FastCGI / CGI

CGI = Common Gateway Interface, and it was most commonly used to execute Perl and C scripts back in the 90's (or any pre-processor). Please correct me if I'm wrong about that. PHP also ships as a CGI module, and it's just an (old fashioned and slow) way of exposing the PHP engine to the HTTP daemon.

FastCGI = a modern implementation of CGI, which is apparently quite good. It's an alternative to ISAPI plugins for IIS and Apache modules.

Static Content

There is absolutally no reason to set up a 2nd server for serving static content. If you're serving images, it's usually a good practice to have a 2nd subdomain to serve your images from, as this means that useless information like Cookies are not sent with the IMG requests. The usefulness of this really depends on your expected traffic levels. You should be able to configure this in Plesk.

share|improve this answer
1  
+1 thank you for the good explanation of the 3. I will be adding the second domain for static content. And on the switching to lighttpd I will wait for the time being. –  Saif Bechan Mar 11 '10 at 1:01
    
@Warner, thanks. I've updated my answer. –  Mark Henderson Mar 11 '10 at 1:36

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.