Arc Forumnew | comments | leaders | submitlogin
3 points by nostrademons 6129 days ago | link | parent

What happens if you need to scale to multiple servers? Or if the server goes down for a reboot?


5 points by pg 6129 days ago | link

You'd do the same sorts of things you'd do in any language.

-----

6 points by nostrademons 6129 days ago | link

In other languages, you'd typically store the session in memcached or the database, and then run multiple web frontends that each connect to the shared memcache instance or DB server. Can you serialize closures and store them in an external backend, assuming the existence of memcached and/or database bindings?

(I'm not asking this to prove a point or be a dick...this is a real issue in a lot of deployments. Java/JSF takes the same approach - it stores the complete state of the user interaction in a tree on the server, and then uses either a cookie or URL parameter to retrieve that state. A coworker and I spent a couple weeks digging into the JSF internals to get it to operate statelessly; the base JSF framework worked fine with a configuration change, but the AJAX framework built on top of it choked miserably.)

-----

1 point by dc27437 6127 days ago | link

What did you do to get the base JSF to work on multiple servers? I am having that issue now - whenever a server switch is done, the context set up by JSF is lost and a blank page shows. Results 2 thru n on the same server are fine, result 1 being the initial page (JSP) request. Thanks.

-----

1 point by nostrademons 6127 days ago | link

For basic JSF, you just set a context-param on your web.xml for javax.faces.STATE_SAVING_METHOD = client.

http://forum.java.sun.com/thread.jspa?threadID=594475&me...

It'll serialize the UIComponent tree and store it in a hidden input field with every interaction, then restore the view from that field. Naturally, this doesn't work if you're using GET for forms. (There's an undocumented feature of JSF where you can change the form method using JavaScript and make it submit information via GET. It tends to break though - you can easily overflow query strings, and I recall some problems when binding components to bean properties.)

-----

1 point by dc27437 6126 days ago | link

Thanks! I appreciate it.

-----