<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Documenting a well known &quot;bug&quot; (design flaw) -- blocking db calls in async io context</title>
		<link>http://wikipbx.subwiki.com/forum/t-155106/documenting-a-well-known-bug-design-flaw-blocking-db-calls-in-async-io-context</link>
		<description>Posts in the discussion thread &quot;Documenting a well known &quot;bug&quot; (design flaw) -- blocking db calls in async io context&quot;</description>
				<copyright></copyright>
		<lastBuildDate>Sat, 31 Jul 2010 15:22:14 +0000</lastBuildDate>
		
					<item>
				<guid>http://wikipbx.subwiki.com/forum/t-155106#post-511052</guid>
				<title>Re: Documenting a well known &quot;bug&quot; (design flaw) -- blocking db calls in async io context</title>
				<link>http://wikipbx.subwiki.com/forum/t-155106/documenting-a-well-known-bug-design-flaw-blocking-db-calls-in-async-io-context#post-511052</link>
				<description></description>
				<pubDate>Wed, 17 Jun 2009 08:34:14 +0000</pubDate>
				<wikidot:authorName>stas_shtin</wikidot:authorName>				<wikidot:authorUserId>230176</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>That's not quite correct. Wikipbx runs every request in its own thread - see twisteddjango module and "grep thread -i". So the blocking DB calls are running in there own threads.</p> <p>I think that the problem of slowing down on heavy load may be caused by the small default thread pool size. If you can test it with default thread pool size and increased as described in twisted threading docs, that may give interesting numbers.</p> <p>But decoupling django and twisted is still a better solution here.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://wikipbx.subwiki.com/forum/t-155106#post-476277</guid>
				<title>Documenting a well known &quot;bug&quot; (design flaw) -- blocking db calls in async io context</title>
				<link>http://wikipbx.subwiki.com/forum/t-155106/documenting-a-well-known-bug-design-flaw-blocking-db-calls-in-async-io-context#post-476277</link>
				<description></description>
				<pubDate>Mon, 11 May 2009 23:45:22 +0000</pubDate>
				<wikidot:authorName>tleyden</wikidot:authorName>				<wikidot:authorUserId>230690</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <h1><span>WikiPBX uses blocking database calls in a twisted webserver</span></h1> <p>This is basically a scalability bug that can have a negative impact when the server runs under a heavy load. The bug will be more apparent if there are long running queries or the database is slow for whatever reason.</p> <p>The problem is that the webserver is running in a non-blocking io environment (eg, twisted web2), but the code makes blocking database calls in many places. So if a database call takes a long time, the whole server will "lock up" for new requests until the long running database call unblocks.</p> <p>The best solution is to move away from using twisted and non-blocking io and use a more traditional multi-threaded/multi-process webserver, eg, mod_wsgi running under Apache2 or nginx.</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>