LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   CGI/Perl/Python (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=22)
-   -   LSWS and Django (http://www.litespeedtech.com/support/forum/showthread.php?t=774)

tpersen 12-06-2006 04:42 PM

LSWS and Django
 
Anyone tried using the python-based Django web framework under Litespeed?

More info at http://www.djangoproject.com/

It's got built-in FCGI support with flup (http://trac.saddi.com/flup), and I've had minimal success running it in threaded mode, and no success running it in prefork mode. When in threaded mode, it serves up pages for a while then returns 503s until I restart the process. Prefork starts up all the processes and then just returns 503s all the time.

On the Django site, they mention that their preferred method of serving is to run apache with mod_python, but I have a feeling Litespeed can outperform it if I can get it running correctly.

Any help is appreciated.

xing 12-06-2006 05:00 PM

tpersen,

Not all FCGI frameworks are created equal.

Try this:

1) Disable "persistent connection" under FCGI extapp.

2) From trac.saddi.com/flup it looks like they support AJP 1.3 interface in-addition to FCGi. Instead of using a FCGI extapp, use a Java/AJP extapp instead.

tpersen 12-07-2006 11:37 PM

The "persistent connection" setting was already set to N/A. I tried setting it to "no", but it didn't make a difference.

It seems that threaded mode is working alright. I think the reason it fails eventually has to do with the process running in debug mode. I haven't tried disabling debug yet, but I think that's where the problem lies.

In prefork mode, however, I am still not getting anything except 503s. I see all the python processes spawn, the socket is created, but they don't seem to be communicating with litespeed. Any other ideas?

Also, I've only tried on my development machine, which is an iMac. I'll try it on one of my linux servers tomorrow and see if I get any different results. Another alternative is that I could try rewriting their fcgi script to use the libraries you recommended instead if nothing else seems to work.

Todd

aemadrid 12-16-2006 09:19 AM

Any luck?
 
What were your results? I have been meaning to try Django for some time but the whole install and deployment seem to be a drag. Any luck getting it to run succesfully? Any tips? I'd love to give it a try under LS.

Thanks in advance,

AEM

Quote:

Originally Posted by tpersen (Post 3678)
The "persistent connection" setting was already set to N/A. I tried setting it to "no", but it didn't make a difference.

It seems that threaded mode is working alright. I think the reason it fails eventually has to do with the process running in debug mode. I haven't tried disabling debug yet, but I think that's where the problem lies.

In prefork mode, however, I am still not getting anything except 503s. I see all the python processes spawn, the socket is created, but they don't seem to be communicating with litespeed. Any other ideas?

Also, I've only tried on my development machine, which is an iMac. I'll try it on one of my linux servers tomorrow and see if I get any different results. Another alternative is that I could try rewriting their fcgi script to use the libraries you recommended instead if nothing else seems to work.

Todd


mistwang 12-16-2006 12:00 PM

Took a brief look at Django document and flup code, I think it should work well with LSWS. Just a little tricky for the FCGI startup command.

If you want LSWS to manage the FCGI instances, you can try:
MaxConn: 20 (<50 is OK, flup support upto 50 connections by default)
Auto Start: true
Command: path_to_manage.py runfcgi daemonize=false (method could be threaded or prefork)
Intance: 1

Make sure you do NOT specify host, port or socket command line option in LSWS managed mode. LSWS will create those sockets.

If you want to start it manually, just set "Auto Start" to false and the follow Django document.

aemadrid 12-16-2006 04:39 PM

Thanks for the info. I'm always pleasantly surprised by the support in this forum. I gave it a try locally and it looked interesting but I don't think I will be using it in production anytime soon.

Thanks again,


Adrian Madrid

Quote:

Originally Posted by mistwang (Post 3752)
Took a brief look at Django document and flup code, I think it should work well with LSWS. Just a little tricky for the FCGI startup command.

If you want LSWS to manage the FCGI instances, you can try:
MaxConn: 20 (<50 is OK, flup support upto 50 connections by default)
Auto Start: true
Command: path_to_manage.py runfcgi daemonize=false (method could be threaded or prefork)
Intance: 1

Make sure you do NOT specify host, port or socket command line option in LSWS managed mode. LSWS will create those sockets.

If you want to start it manually, just set "Auto Start" to false and the follow Django document.


hvendelbo 07-27-2007 03:39 AM

one working setup
 
If anyone stumble upon this thread.

I have a working setup using the AJP connector.

Initially I used it in threading mode, but I think the session support in django doesn't like that, so I had to switch to forked. The performance hit isn't terrible, but it's still annoying.

mistwang 07-27-2007 08:30 AM

How does it compare with other python API interface written in pure python, performance wise?


All times are GMT -7. The time now is 09:56 PM.