[mod_python] modpy3.2 + apache2.2 + odbc + dbisam - substitutetocgi ?

Graham Dumpleton grahamd at dscpl.com.au
Wed Jan 24 17:04:10 EST 2007


durumdara wrote ..
> Hi!
> 
> Sorry, but I not understand it fully.
> I thinking about that:
> 
>     If I do this, only one interpreter created.
>     And this interpreter serve all of the requests.
>     So any concurrent requests are "need to pause" until the interpreter
>     getting free state, and  ready to serve the next request.
> 
> Or I thinking wrong?
> If not, that is making "slow" serving, or not?

As I explained in posts in the last day or so in response to questions by
Suresh, how many Python subinterpreters are created has got nothing to do with
concurrency of requests. Subinterpreters are used merely to keep data from
different applications linked to different URLs separate so they do not
interfere with each other. Even if all requests are handled within the one
subinterpreter, there can still be concurrent requests being handled at the
same time within different threads where a multithreaded MPM is used such as on
Windows or with worker MPM on UNIX.

Thus, forcing the "main_interpreter" to be used is not an issue, will not slow
down handling of requests and may solve problems caused by poorly written
third party extensions for Python which expect to be run from the first Python
interpreter created within a process.

> Any question that if I must use cgi, can I use template system without
> any problems? Rendering is need apache import? If yes, it is not working
> in normal interpreter...

You can use any template system you want in CGI provided that it isn't dependent
on mod_python. Ie., you can't use mod_python.psp for example, and can otherwise
work with CGI environment.

Graham

> Thanks for your help:
>     dd
> 
> Graham Dumpleton wrote:
> > If not doing so already, force all your mod_python request handlers to
> run
> > within the context of the first Python interpreter instance created by
> > mod_python by using:
> >
> >   PythonInterpeter main_interpreter
> >
> > I think you need to have at least mod_python 3.2.10 for this to
> > be of any use because of bugs in earlier versions of mod_python.
> >
> > This can be required where third party Python modules are not written
> > correctly so as to be usable from secondary interpreters. For more
> > details on what this issue is about, see:
> >
> >   http://issues.apache.org/jira/browse/MODPYTHON-77
> >
> > That said, this may not help at all and is just a guess.
> >
> > Graham
> >
> > durumdara wrote ..
> >   
> >> Hi!
> >>
> >> My problem is that:
> >>
> >> I need to use DBISAM databases.
> >> There is no native Python driver for DBISAM, but DBISAM have ODBC driver.
> >>
> >> I build two sites with DBISAM local database, and with ODBC drived by
> >> pywin32 odbc module.
> >> Everything is worked good (it seems to be) if I drop my cursors on every
> >> request.
> >>
> >> But now I needed to change ODBC to remote mode (to read remote database).
> >> Yesterday I simple changed the settings of the driver, and next I found
> >> me in the hell... :-(((
> >>
> >> In every 2.-3. request the httpd.exe is crashed. No error msg. generated
> >> (logs), only Windows create some dumps about it.
> >> In the event log I see that ntdll.dll and sometimes the odbc.pyd is
> the
> >> source of the error.
> >> Interesting thing, that my sites are working good with odbc.pyd and
> >> DBISAM when they are not used remote databases.
> >>
> >> I tried everything: I set MaxReqPChild to 1 (to cleanup), close 
> >> cursors/databases on finishing of scripts, etc.
> >> When I try to do same thing with normal python interpreter, I cannot
> do
> >> it. I can open many-many connections, and they are cleaned up normally...
> >>
> >> Next I downloaded mxODBC, and tried it. It is working good, but it's
> >> prices are not good for me.
> >>
> >> Today I download the pyodbc package, but it is possible not thread-safe.
> >> Or possible it is not working good later, I don't know.
> >> I have not experienced with this.
> >>
> >> BUT IF WILL NOT WORKING, I WILL NEED SOME CHANGING.
> >>
> >> So:
> >> I need some information to prepare to change if needed.
> >> There is two way to working with dbisam + odbc under apache.
> >> First: I need to write a database server (socketserver) that communicate
> >> beetween my apache processes and ODBC database. It is payful.
> >> Second: I need to change to cgi mode to avoid these problems.
> >>
> >> Please help me: what you offer me when I want to use cgi? The modpy
> >> library can supports this working mode? Or what I need to do for it?
> >> Please offer me some library, and example to prepare if the problems
> >> appearing!
> >>
> >> Thanks for your help:
> >>     dd
> >>
> >> _______________________________________________
> >> Mod_python mailing list
> >> Mod_python at modpython.org
> >> http://mailman.modpython.org/mailman/listinfo/mod_python
> >>     
> >
> >   


More information about the Mod_python mailing list