Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » SCGI Class
Re: SCGI Class [message #31759 is a reply to message #31603] Thu, 24 March 2011 22:44 Go to previous messageGo to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

I plan using SCGI server class for potentially high-load service and so I make some tests first.
Simple example is created:
#include <Core/Core.h>
#include <Web/Web.h>
using namespace Upp;

class MyScgiServer : public ScgiServer
{
public:
	MyScgiServer() :ScgiServer(7000) {}

	virtual void OnRequest()
	{
		Write("HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\nHello, world!");
	}

private:
};

CONSOLE_APP_MAIN
{
	MyScgiServer server;
	server.Run();
	Cout() << "cleanup exit";
}

From the first glance, it works well, at least in junction with nginx/mod_scgi. You may even try no-so-high-load tests which will give you good results:
Quote:

$ ab -t 10 -c 8 localhost:7000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:
Server Hostname: localhost
Server Port: 7000

Document Path: /
Document Length: 13 bytes

Concurrency Level: 8
Time taken for tests: 6.806 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 2900000 bytes
HTML transferred: 650000 bytes
Requests per second: 7346.41 [#/sec] (mean)
Time per request: 1.089 [ms] (mean)
Time per request: 0.136 [ms] (mean, across all concurrent requests)
Transfer rate: 416.11 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 18
Processing: 0 1 1.1 1 48
Waiting: 0 1 0.8 1 46
Total: 0 1 1.2 1 56

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 2
99% 2
100% 56 (longest request)



The bad thing is that if you try to test with concurrency > 10, your test will fail:
Quote:

$ ab -t 10 -c 9 localhost:7000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
apr_socket_recv: Connection reset by peer (54)
Total of 13 requests completed



I started investigation on the source of the problem. If you have any clues, you are welcome.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How should we deal with SQL column names in conflict with SQL standard keywords
Next Topic: What's up with Google subversion mirror?
Goto Forum:
  


Current Time: Sun May 12 08:40:10 CEST 2024

Total time taken to generate the page: 0.03755 seconds