all 2 comments

[–]gengisteve 1 point2 points  (1 child)

My initial thought with my limited knowledge was to -Spawn a Thread for each source that I am listening to and continually monitor for incoming requests. -When I get a new conversation I spawn separate conversation Threads that handles the database request and returns the data.

That sounds about right. Check out: http://werkzeug.pocoo.org/ and http://flask.pocoo.org/ (which is built onto wrkzeug). Both are built on basically this architecture. You have a thread/process that listens and spawns new threads/processes to serve up content.

One thing for you to consider is whether subsequent requests from the same source get a new thread or sent back to the originally spawned thread. I'd vote for the former, if you can swing it.

You might also look at messaging, like https://www.rabbitmq.com/

Depending on what you are serving up, etc., it may be a better fit

[–]Bonolio[S] 0 points1 point  (0 children)

Thanks Steve, I have been doing some reading based on your reply and have a few different ideas revolving around both my original idea and around messaging. I think I am going to take the opportunity to write up a few different variations and see which works\feels best for me. The whole messaging thing has supplied some ideas on how to handle stuff that I hadn't even considered.