Web Servers: What are some best-practices for writing multi-thread programs with Django and Python?
-
What I'm doing is getting some photos from Foursquare and Instagram. An API(REST) call triggers Foursquare query to get 30 places. Then 30 queries are issued to Foursquare to get a photo for each place. I've implemented the second queries by threads to get 30 responses as fast as it can. My concern is that if there are several users who issue the API the response might be slow. The system is using Apache, Django(python), single machine(Rackspace 512MB). What is the best practice to implement a job which requires concurrent processing.
-
Answer:
Use thread pool to limit number of workers. Read more about them at: http://stackoverflow.com/questions/3033952/python-thread-pool-similar-to-the-multiprocessing-pool
Alexander Artemenko at Quora Visit the source
Related Q & A:
- What are some best practices to follow when designing for users completely unfamiliar with computers?Best solution by User Experience
- What is the best way to learn how to build websites and web applications with Python?Best solution by Quora
- What are the best jobs in writing?Best solution by Ask.Metafilter.Com
- What is the best system? The multi party or the two party system?Best solution by Answerbag.com
- What is the best multi level marketing program?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.