Stateful application: supported?

89 views
Skip to first unread message

cbus...@voxeolabs.com

unread,
May 13, 2013, 5:04:50 PM5/13/13
to vcap...@cloudfoundry.org
Hi,

one of my applications is stateful, i.e., a given client has to keep interacting with a specific instance (the one first used by that client). I can determine the specific port of an instance and use that, however, I am not sure if this is a good way as the client would have to know that port. What is the best way to support stateful applications in CF?

Thanks,

Christoph

Mark Rushakoff

unread,
May 14, 2013, 9:24:31 PM5/14/13
to vcap...@cloudfoundry.org
Hi Christoph,

To the best of my knowledge, there currently is no support for what you've described.  When we launch production on AWS, we will be behind an Amazon ELB, so I think using [Application-Controlled Sticky Sessions](http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/US_StickySessions.html#US_EnableStickySessionsAppCookies) would be the best option for us to support your needs while also supporting random routing for stateless applications.  Someone from the product side of CF will have to make the final call on that.

Mark

Dave Syer

unread,
May 15, 2013, 2:34:01 AM5/15/13
to vcap...@cloudfoundry.org
On 13/05/13 22:04, cbus...@voxeolabs.com wrote:
> What is the best way to support stateful applications in CF?

The CF router does sticky sessions for Java apps (cookie JSESSIONID). I
think it probably has some other cookie keys it can route on, but that
is based on my knowledge of v1 router (v2 I haven't looked at). I would
have a look at the router code if I were you, to verify one way or the
other.

--
Dave Syer
ds...@gopivital.com


Gandalf Corvotempesta

unread,
May 15, 2013, 3:31:57 AM5/15/13
to vcap...@cloudfoundry.org
2013/5/15 Dave Syer <ds...@gopivotal.com>:
> The CF router does sticky sessions for Java apps (cookie JSESSIONID). I
> think it probably has some other cookie keys it can route on, but that is
> based on my knowledge of v1 router (v2 I haven't looked at). I would have a
> look at the router code if I were you, to verify one way or the other.

It should be here:
https://github.com/cloudfoundry/gorouter/blob/master/src/router/proxy.go#L221
https://github.com/cloudfoundry/gorouter/blob/master/src/router/proxy.go#L105

StickyCookieKey is defined in top of file as JSESSIONID

Maria Shaldibina

unread,
May 15, 2013, 1:28:25 PM5/15/13
to vcap...@cloudfoundry.org
Right, the sticky session can be achieved via JSESSIONID cookie. And it actually works with ruby and node apps as well. Here is an example of the Node.js app, that uses sticky sessions: 


-Maria

On Monday, May 13, 2013 2:04:50 PM UTC-7, cbus...@voxeolabs.com wrote:
Reply all
Reply to author
Forward
0 new messages