Hi,

> I'm creating an application containing two interfaces: a socket server
> and a web interface. Both interfaces require access to the same
> database, and there will be a small amount of communication between
> the two interfaces.
>
> I want to use Django for the web interface, as well as the ORM for the
> socket server.
>
> I see two options for implementing this:
>
> 1 - Run the two interfaces as separate processes. The socket server
> will import the Django code from the web interface for the ORM. Inter-
> process communication can be done via sockets.
>
> 2 - Run both interfaces in the same process. This will require the
> socket server to be started by the Django web interface.
>
> The first option seems like the cleaner solution. Will it cause any
> concurrency issues with the ORM?
>
> The second option seems easier to implement (especially the
> communication between the two interfaces), but I don't really like the
> idea of the web server starting the socket server.
>
> Which option would work better?
>
> For the second option, what is the best way to start the socket server
> from Django?

The second option doesn't look clean. You are essentially providing
two types of services. So you should consider running them as two
separate processes (say your application requires a lot of scalability
in the future: wouldn't you then want to be able to run all these
services on separate boxes let alone in separate processes?)

There should be no ORM concurrency issues because as it is you can run
your Django app on multiple frontend servers all going to a common DB
server for scalability reasons. Django's "share-nothing" architecture
already supports that. Your option #1 above is similar to that
arrangement where one of the frontends happens to be a different type
of a server than a regular web server.

If you plan on communicating between these two types of services over
TCP sockets, I don't see why that would be easier with option #2 than
with option #1. Socket communication shouldn't have to care if the end
points of the socket belong to the same process or two different
processes.

Hope this helps,
-Rajesh D

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to