Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'frameworks': 0.04; 'avoiding': 0.05; 'soap': 0.05; 'django,': 0.07; 'json': 0.07; 'received:209.85.213.46': 0.07; 'received:mail- yw0-f46.google.com': 0.07; 'python': 0.07; 'admit': 0.09; 'now?': 0.09; 'web2py,': 0.09; 'looked': 0.10; 'am,': 0.14; 'wrote:': 0.14; 'cores': 0.16; 'subject:GIL': 0.16; 'threading': 0.16; 'xml)': 0.16; 'framework': 0.16; 'subject:Questions': 0.19; 'seems': 0.21; 'header:In-Reply-To:1': 0.22; 'issue.': 0.22; 'gil': 0.23; 'received:209.85.213': 0.23; 'apache': 0.25; 'xml': 0.26; "i'm": 0.26; 'instead': 0.26; 'chris': 0.27; 'object': 0.27; 'google': 0.27; 'thanks': 0.29; 'server': 0.29; 'formats': 0.29; 'indicated': 0.29; 'minimal': 0.29; 'probably': 0.30; 'implement': 0.30; 'lock': 0.31; 'received:96': 0.31; 'transport': 0.31; 'url:projects': 0.31; 'format.': 0.31; 'anyone': 0.31; 'to:addr :python-list': 0.32; "i've": 0.33; 'url:docs': 0.33; 'relatively': 0.33; 'someone': 0.33; 'data.': 0.33; 'starting': 0.34; 'there': 0.35; 'finding': 0.35; 'header:User-Agent:1': 0.35; 'defining': 0.35; 'limitations': 0.35; 'status,': 0.35; 'allow': 0.36; 'data': 0.37; 'rest': 0.37; 'received:209.85': 0.37; 'issue': 0.37; 'subject:web': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'pretty': 0.38; 'url:org': 0.38; 'used': 0.38; 'not,': 0.39; 'returning': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'how': 0.39; 'include': 0.40; "it's": 0.40; 'header:Received:5': 0.40; 'simple': 0.60; 'best': 0.60; 'design': 0.61; 'view': 0.64; 'subject:about': 0.66; 'due': 0.67; 'articles': 0.67; 'url:0': 0.69; 'url:it': 0.80; 'most,': 0.84; 'pyramid': 0.84; 'service?': 0.84; 'replied.': 0.91; 'exchanging': 0.93; 'subject:services': 0.93 Date: Wed, 20 Apr 2011 16:01:52 -0400 From: Chris H Organization: Windsor Circle User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Questions about GIL and web services from a n00b References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303329718 news.xs4all.nl 41110 [::ffff:82.94.164.166]:55044 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3745 On 4/19/11 3:48 AM, Lamont Nelson wrote: > > 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 Thanks to everyone who has replied. I have a better understanding of the limitations around the GIL as well as the relatively architectures for avoiding the issue. Now to find the right framework for a simple web service. So far I've heard pyramid the most, but others we are looking into include rest.ish.io, web2py, and flask. Anyone with experience across these as to what is best for someone starting from scratch now? Chris