Using Pythomnic behind Apache?

Anything about Pythomnic goes here

Using Pythomnic behind Apache?

by ajd on Sat Apr 19, 2008 8:25 am

I note this forum seems a bit... dead, but has anyone run a Pythomnic cage behind Apache?
ajd
 
Posts: 4
Joined: Sat Apr 19, 2008 8:22 am

by Targeted on Sat Apr 19, 2008 4:25 pm

What would be the purpose of such setup ? Let's say apache accepts HTTP request and parses it, then what ? Over what kind of protocol would it talk to pythomnic ? You would need to utilize some kind of apache module for that, no ?
Targeted
Site Admin
 
Posts: 265
Joined: Mon Jan 12, 2004 7:00 am

by ajd on Sun Apr 20, 2008 5:51 am

Well, to handle HTTP requests on a machine running Apache without running it on a different port, I suppose. Not that great a reason, I admit.

Hypothetically though, I suppose a small Apache module and protocol receiver could be written to do it.
ajd
 
Posts: 4
Joined: Sat Apr 19, 2008 8:22 am

by Targeted on Sun Apr 20, 2008 8:18 am

How about having an HTTP balancer/redirector (pound I could recommend) in front of both apache and pythomnic ? This way both of them would listen to different arbitrary ports at localhost, whereas the port originally used to apache would be taken by the balancer. It could tell where to redirect which requests by the virtual host or part of the URL.
Targeted
Site Admin
 
Posts: 265
Joined: Mon Jan 12, 2004 7:00 am

by ajd on Sun Apr 20, 2008 10:03 am

That's also a good option I suppose.

Have any Python web servers based on BaseHTTPServer been load-tested before? I know that for some frameworks like Django it's recommended to use mod_python or FastCGI rather than running a Python server directly. I suppose though the overhead of FastCGI would be worse than the savings of Apache's request handling.
ajd
 
Posts: 4
Joined: Sat Apr 19, 2008 8:22 am

by Targeted on Sun Apr 20, 2008 5:11 pm

I have performed a throughput testing with the previous version of Pythomnic, when its HTTP interface was based on CherryPy. Mostly because I wanted to see how fast the simple session tracking based on cookies and pmnc_safe (i.e. BerkeleyDB) was. It maxed out at about 150-200 reqs/sec.

In version 6 I chose to discard session tracking altogether, leaving Pythomnic HTTP requests usable for stateless RESTful kind of web services, rather than stateful browser sessions. The number of worker threads that actually perform the request processing for a given interface is configured in config_interfaces:

Code: Select all
config.set("http_interface.worker_threads", 10)


therefore at most 10 requests will get in processing simultaneously, the rest will get queued up as described here. Keep this in mind if you decide to give it a test.
Targeted
Site Admin
 
Posts: 265
Joined: Mon Jan 12, 2004 7:00 am

by ajd on Sun Apr 20, 2008 11:36 pm

150 reqs/sec, that's quite a lot

I've read about the request queueing. I suppose depending on the server's specifications the number of threads could be increased.
ajd
 
Posts: 4
Joined: Sat Apr 19, 2008 8:22 am


Return to Pythomnic General Questions

Who is online

Users browsing this forum: Alexa [Bot] and 0 guests