1. SCGI, Euphoria, 9,000 requests a second

I got SCGI working with EuNet. Here are benchmarks of a Hello World program:

---- CGI:

Total transferred:      16620 bytes
HTML transferred:       3800 bytes
Requests per second:    795.23 [#/sec] (mean)
Time per request:       1.258 [ms] (mean)
Time per request:       1.258 [ms] (mean, across all concurrent requests)
Transfer rate:          127.24 [Kbytes/sec] received

---- SCGI:

Total transferred:      159943 bytes
HTML transferred:       37278 bytes
Requests per second:    8986.74 [#/sec] (mean)
Time per request:       0.111 [ms] (mean)
Time per request:       0.111 [ms] (mean, across all concurrent requests)
Transfer rate:          1401.93 [Kbytes/sec] received

----

Now, here's the good part. This Hello World app is the app that your going to
see the least performance increase on! Reason? It's tiny so not much
parsing/startup time taken by Euphoria but more than that, once you get involved
and have database connections, the CGI app has to connect/disconnect to/from the
database every request. Not so with SCGI since it is stateful.

So, when the application loads, you connect to the database, you then start
listening for connections from the web server. When a connection comes in, you
handle it, and then are back at the top of your loop again. No need to
connect/disconnect. Oh, also, you can run many independent copies of your SCGI
program not only on the same machine, but on multiple machines as it utilizes
TCP/IP connections, thus, you can distribute the load, if you are by chance
running a 100 million hit per day website smile

So, more on this later, but first, here are the two test programs benchmarked
above:

---- hello.cgi
puts(1, "Content-type: text/html\r\n\r\n")
puts(1, "<html><body>Hello World!</body></html>")


---- hello.scgi
sequence scgi_server
atom sock

scgi_server = scgi:new(3015)

while 1 do
    sock = scgi:wait(scgi_server)
    scgi:puts(sock, "Content-type: text/html\r\n\r\n")
    scgi:puts(sock, "<html><body>Hello World!</body></html>")
end while


--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » topic index » view message » categorize

2. Re: SCGI, Euphoria, 9,000 requests a second

Sounds great, I have some questions:

1- This program is supossed to run 24/7 and 
your web hosting will not be happy with your 
program takes a big slice of the processing 
resources.  (Of course, not problem if you run 
your own server.)  There is a way to include 
some idle times to return control to the OS 
when there is not high trafic?

2- May this run on any web server?

3- Is SCGI the same as FastCGI?


+-+-+-+-+-+-+-+
Marco A. Achury
Caracas, Venezuela

new topic     » goto parent     » topic index » view message » categorize

3. Re: SCGI, Euphoria, 9,000 requests a second

Marco Achury wrote:
> 
> 
> Sounds great, I have some questions:
> 
> 1- This program is supossed to run 24/7 and 
> your web hosting will not be happy with your 
> program takes a big slice of the processing 
> resources.  (Of course, not problem if you run 
> your own server.)  There is a way to include 
> some idle times to return control to the OS 
> when there is not high trafic?

The application is sitting idle all the time, unless taking a request. It's a
stand alone application. When it's not handling a request, the CPU usage taken by
the application does not even register in top, it's listed as 0%.

Any web host who lets you run FastCGI will also allow SCGI. Probably many cheap
shared web hosting companies will allow neither.
 
> 2- May this run on any web server?

Not any, but the major ones have SCGI modules.
 
> 3- Is SCGI the same as FastCGI?

Not exactly. Same principal but SCGI is a much easier protocol to use,
therefore, it has gained a substantial following. FastCGI is older though.

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: SCGI, Euphoria, 9,000 requests a second

Jeremy Cowgar wrote:
> 
> Not so with SCGI since it is stateful.

Does this work with Apache?

new topic     » goto parent     » topic index » view message » categorize

5. Re: SCGI, Euphoria, 9,000 requests a second

c.k.lester wrote:
> 
> Jeremy Cowgar wrote:
> > 
> > Not so with SCGI since it is stateful.
> 
> Does this work with Apache?

Yes, mod_scgi.

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu