Questions about GIL and web services from a n00b

Lamont Nelson lamont at brightfruits.com
Tue Apr 19 03:48:44 EDT 2011


 > 1. Are you sure you want to use python because threading is not
good due
> to the Global Lock (GIL)?  Is this really an issue for multi-threaded
> web services as seems to be indicated by the articles from a Google
> search?  If not, how do you avoid this issue in a multi-threaded process
> to take advantage of all the CPU cores available?

To take advantage of the cores on your server you'll want to consider
a multi-process design instead of multi-threading. You can achieve
this with something like http://projects.unbit.it/uwsgi/, which will
allow you to manage the processes. I've used this behind apache
successfully.

>
> 2. Are there good web services frameworks available for building a REST
> based service?  I admit I have looked at web2py, Django, pyramid/pylons,
> and a few others.  SOAP seems to be pretty well supported but I'm not
> finding the same for quick development of REST based services for
> exchanging JSON or XML formatted data.  This is probably just my n00b
> status, but what tools are best for building a simple REST data exchange
> API?

I've personally used Pyramid to implement REST web services with
multiple data transport formats (json, xml) for the same endpoints
with minimal fuss. It's basically as simple as returning an object
from your view and defining a renderer that knows how to translate
this object to the desired format. Look at
http://docs.pylonsproject.org/projects/pyramid/1.0/narr/renderers.html#views-which-use-a-renderer
and http://docs.pylonsproject.org/projects/pyramid/1.0/narr/viewconfig.html#view-config-chapter
for more information.

Lamont



More information about the Python-list mailing list