Re: [modwsgi] daemon mode question

25 views
Skip to first unread message

Graham Dumpleton

unread,
Nov 6, 2012, 4:27:05 PM11/6/12
to mod...@googlegroups.com
Sounds like it is more of a specific issue with that database which
you would want to ask the developers/community of that database. That
is, how to use from multiple processes at the same time.

I can only offer up general advice at end of:

http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

Is there any specific reason you can't use a single multithreaded
daemon process? Does the traffic volume warrant multiple processes? Is
your code thread safe?

Graham

On 7 November 2012 01:26, Ferencik Ioan <ferenc...@gmail.com> wrote:
> Hello folks,
>
> I am facing following issue and was wondering whether anybody could have a
> suggestion.
> I am running mod_wsgi /python 2.7.3 on a ubuntu 12.04 box.
>
> My web application is django based but is is using just one view.
> The issue i have is following.
>
> I have a class A. This class uses a metaclass that inserts the instance in a
> object oriented database (dybase).
> The database file is opened by the metaclass and closed when the interpreter
> exits (when i close bpython) using atexit hook.
> The issue is that apache runs this view from multiple processes. SO if i
> query the index for the nr of object each process reports a different
> number.
> The database has exclusive locks but i did not manage to use them correctly.
>
> My point is i do not know exactly what is the best way to:
>
> open/close the database
>
> when to lock the index
>
> so i get correct results.
> FYI if i use the daemon with 1 process everything works fine.
> I hope i wasn't very cryptic.
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/kjxgc2C1oywJ.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Ferencik Ioan

unread,
Nov 7, 2012, 6:41:24 AM11/7/12
to mod...@googlegroups.com
Hello Graham,
thanks for the timely reply.
The issue was indeed database specific, I contacted the developers and found that my DB does not support multiple processes.
I have low traffic so I disabled the processes. I could also use only one.
Everything works fine.

I can also say if anyone is interested i open the connection on per interpreter basis
and close it when the mod_wsgi exist (server is restarted/stopped)


Thanks again.

Graham Dumpleton

unread,
Nov 7, 2012, 6:47:00 AM11/7/12
to mod...@googlegroups.com
If one database connection per interpreter (process), for a
multithread application there could be an issue if the multiple
threads are trying to use the one database connection. How are you
protecting against that?

Graham
> https://groups.google.com/d/msg/modwsgi/-/pEBHa90BC_0J.
Reply all
Reply to author
Forward
0 new messages