summaryrefslogtreecommitdiff
path: root/.html/dev/stop-building-synchronous-web-containers.html
diff options
context:
space:
mode:
Diffstat (limited to '.html/dev/stop-building-synchronous-web-containers.html')
-rw-r--r--.html/dev/stop-building-synchronous-web-containers.html135
1 files changed, 135 insertions, 0 deletions
diff --git a/.html/dev/stop-building-synchronous-web-containers.html b/.html/dev/stop-building-synchronous-web-containers.html
new file mode 100644
index 0000000..85a1e52
--- /dev/null
+++ b/.html/dev/stop-building-synchronous-web-containers.html
@@ -0,0 +1,135 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>
+ The Codex »
+ Stop Building Synchronous Web Containers
+ </title>
+
+ <link
+ rel='stylesheet'
+ type='text/css'
+ href='http://fonts.googleapis.com/css?family=Buenard:400,700&amp;subset=latin,latin-ext'>
+ <link
+ rel="stylesheet"
+ type="text/css"
+ href="../media/css/reset.css">
+ <link
+ rel="stylesheet"
+ type="text/css"
+ href="../media/css/grimoire.css">
+</head>
+<body>
+
+<div id="shell">
+
+ <ol id="breadcrumbs">
+
+ <li class="crumb-0 not-last">
+
+ <a href="../">index</a>
+
+ </li>
+
+ <li class="crumb-1 not-last">
+
+ <a href="./">dev</a>
+
+ </li>
+
+ <li class="crumb-2 last">
+
+ stop-building-synchronous-web-containers
+
+ </li>
+
+ </ol>
+
+
+
+ <div id="article">
+ <h1 id="stop-building-synchronous-web-containers">Stop Building Synchronous Web Containers</h1>
+<p>Seriously, stop it. It's surreally difficult to build a sane ansynchronous service on top of a synchronous API, but building a synchronous service on top of an asynchronous API is easy.</p>
+<ul>
+<li>
+<p>WSGI: container calls the application as a function, and uses the return
+ value for the response body. Asynchronous apps generally use a non-WSGI
+ base (see for example <a href="http://bottlepy.org/docs/dev/async.html">Bottle</a>).</p>
+</li>
+<li>
+<p>Rack: container calls the application as a method, and uses the return
+ value for the complete response. Asynchronous apps generally use a non-Rack
+ base (see <a href="https://github.com/rkh/async-rack/issues/5">this Github ticket</a>).</p>
+</li>
+<li>
+<p>Java Servlets: container calls the application as a method, passing a
+ callback-bearing object as a parameter. The container commits and closes
+ the response as soon as the application method returns. Asynchronous apps
+ can use a standard API that operates by <em>re-invoking</em> the servlet method as
+ needed.</p>
+</li>
+<li>
+<p>What does .Net do?</p>
+</li>
+</ul>
+<p>vs</p>
+<ul>
+<li>ExpressJS: container calls the application as a function, passing a
+ callback-bearing object as a parameter. The application is responsible for
+ indicating that the response is complete.</li>
+</ul>
+<h2 id="synchronous-web-containers-are-bad-api-design">Synchronous web containers are bad API design</h2>
+<ul>
+<li>
+<p>Make the easy parts easy (this works)</p>
+</li>
+<li>
+<p>Make the hard parts possible (OH SHIT)</p>
+</li>
+</ul>
+<h2 id="writing-synchronous-adapters-for-async-apis-is-easy">Writing synchronous adapters for async APIs is easy</h2>
+<pre><code>def adapter(request, response_callback):
+ synchronous_response = synchronous_entry_point(request)
+ return response_callback(synchronous_response)
+</code></pre>
+<p>Going the other way is more or less impossible, which is why websocket
+support, HTML5 server-sent event support, and every other async tool for the
+web has an awful server interface.</p>
+ </div>
+
+
+
+<div id="comments">
+<div id="disqus_thread"></div>
+<script type="text/javascript">
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+ var disqus_shortname = 'grimoire'; // required: replace example with your forum shortname
+
+ /* * * DON'T EDIT BELOW THIS LINE * * */
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+</div>
+
+
+
+ <div id="footer">
+ <p>
+
+ The Codex —
+
+ Powered by <a href="http://markdoc.org/">Markdoc</a>.
+
+<a href="https://bitbucket.org/ojacobson/grimoire.ca/src/master/wiki/dev/stop-building-synchronous-web-containers.md">See this page on Bitbucket</a> (<a href="https://bitbucket.org/ojacobson/grimoire.ca/history-node/master/wiki/dev/stop-building-synchronous-web-containers.md">history</a>).
+
+ </p>
+ </div>
+
+</div>
+</body>
+</html> \ No newline at end of file