Using Erlang for your Web 2.0 Application Server
SlideAware - Wolfgang Mathurin - May 04, 2007In the last post, I gave an overview of the evolution we went through. Today I want to describe in more detail what we have built. There is a lot of ground to cover, so I will focus for now on the front-end of the server architecture, i.e., the part that interacts with the clients: the browser and the PowerPoint add-in.
We will discuss our approaches to database clustering (using pg2 and mnesia), full text search (using mnesia) and file storage (using Amazon S3) in future articles.
A simple URL mapping layer
We built a simple layer over Yaws to map URLs of the form x/y to calls to module www_x,
function do_y and prepare the returned value (JSON, XML, HTML or simply an
error code) for the response.
The AJAX calls and the XMLHttpRequests from Flash use JSON. The calls from the
PowerPoint add-in expect XML. HTML is only generated for the requests that
render the initial screens (login page, main page, etc).
The module www_x must also implement a check_access function that our layer
calls first before calling do_y. Most of the time check_access calls a utility
function that checks your cookies, in some cases no authentication is required
(e.g. the login screen).
No sessions
The server keeps no state about sessions. Each request is self-contained which allows us to use any load balancing solution or to bring servers down for short amount of time without logging out users. Instead we rely on cookies (which we pass around as a request parameter, in the case of the PowerPoint add-in calls). Simply storing user (and other) ids in the cookie would be unsafe. Storing a key that would need to be looked up to recognize a user would effectively mean having persisted session ids. So instead, we store the user (and other) ids in the cookie in an encrypted string.
Apache + Yaws combo
On the deployment side, we started with Yaws serving static and dynamic content.
We then went through a benchmarking exercise (using Ab and Tsung). We could fill an article just on that, let
just say that at the end, Apache 2 with the right configuration and the worker
MPM did better on our tests than Yaws 1.68.
After that, we had Apache for static requests, and Yaws behind Apache (using
mod_proxy) for dynamic requests. More benchmarking showed us that Yaws alone
was much better than Apache + mod_proxy + Yaws for dynamic requests.
So now, we have Apache 2 for static requests and Yaws for dynamic requests. personal.slideaware.com
goes to Yaws while static.slideaware.com goes to Apache.
Coming next…
SlideAware Personal helps user distribute presentations:
- either asynchronously with controls about who can see the presentation and analytics about what was seen and who saw it,
- or synchronously (think WebEx).
Our next technology post will describe how we can support many live slide shows simultaneously thanks to Erlang.
Categories: Companies SlideAware
Erlang on Twitter
» tunixman (Rofl Scale): RT @NotDoctorOk: We could, to be ridiculous, represent each Unicode codepoint as a sequence of 21 bytes each with value 0x30 or 0x31. http:…
» NashFP (NashFP): RT @JCCodeHound: @bryan_hunter @NashFP good read. you could ALMOST say it about any Func lang http://t.co/CARea22xlW
» ErlangLisp (Lisp Flavored Erlang): @0xAX You are most welcome! Having the .mobi-generation in place is going to motivate User Guide additions, too :-) #lfe #erlang #lisp
» ravelll (歩くメンチカツ): 残る言語で次にパッと上がるのがSchemeとかerlangとかなんだけど。初週から大変なことになってる。
» jedws (Jed Wesley-Smith): RT @NotDoctorOk: We could, to be ridiculous, represent each Unicode codepoint as a sequence of 21 bytes each with value 0x30 or 0x31. http:…
» alvaro_m91 (Alvaro Marambio): @pipiitA2 Erlang Nigma agregame que jugamos un día ! :D Y de una sale viciar cuando esté el Latinoamerica SUr ? :D
» tsubame959 (Hokuto Takai): RT @HNTweets: Elixir 0.9.0 released. Reducers inspired by Clojure’s Reducers on the Erlang VM: http://t.co/3Pip1TZc2R Comments: https://t.c…
» endemics (Gildas Le Nadan): Yay #tsung 1.5 is out! Amqp bosh websocket http://t.co/RSHECsDIlL
» diiico_ (dico adhitya): Waisak..besok pagi harus resik resik klenteng dewa erlang ini..
» tajgur (Martin Wiso): RT @0xAX: Added new configuration option to #Ybot - use_web_admin::boolean(), choose start or not web interace https://t.co/Duh6ALdxV1 #git…
Statistics
Number of aggregated posts: 10651
Most recent article: May 21, 2013
Latest comments
» Moraru on This is Why You Spent All that Time Learning to Program: It is true that computer science was a pain in the back at time that i’ve had to learn it…
» Commercial hand dryers on Couchbase Meetup at new HQ: Buy online from here where you will get so much of variety in Commercial hand dryers for people. If you…
» Fort McMurray Homes on Motivated Reasoning and Erlang vs Python vs Node: I don’t really understand why this post is motivational? I don’t even see a post, just a title. Fort McMurray…