Hi Pubudu,

Just to be clear, this feature should work on per webapp basis. i.e not all
webapps' sessions should be replicated, but the selected ones by the user.
Earlier we used a webapp context property (distributable) to enable this at
webapp level.

Also here are the test cases that comes to mind.

Say that we have a two node cluster (node-1, node-2)
1. Start both nodes -> change session values at node-1, then check whether
those changes are reflected at node-2 (also check this both ways).
2. Start node-1 -> change session values at node-1 -> start node-2 and
check whether session got replicated to node-2.
3. Same as #2 above, but after the third step, stop node-1 and change the
session values at node-2 then start node-1 again and check the session
state. This should have the latest changes at node-1 even-though that node
was offline for while.

The above tests should make sure that session object was available all the
time in the cluster, even-though the nodes were not available all the time.

The next step is to test this with ELB setup.
Say that we have a 1-Mgt+2-Worker setup fronted by an ELB. Since our ELB is
session aware, it will send the requests to the same node based on the
seesionID. And when that node goes offline, it will route the requests to
the other node. But if we have enabled replication, this routing should
work seamlessly where the same session object - which was replicated - will
be used by the second node.

So lets first do these tests and see.

Thanks,
Kishanthan.

On Mon, Oct 13, 2014 at 10:37 PM, Pubudu Dissanayake <pubu...@wso2.com>
wrote:

> I haven't drop the idea of using HttpSessionManager but what i thought
> was to evaluate how extent we can use this feature as a global web filter
> and HttpSessionListener is already placed in the global filter. In the
> current implementation Hazelcast creates a cluster per webapp, but I'm in
> progress of make it a single cluster shared across all webapps.
>
> On Mon, Oct 13, 2014 at 10:21 PM, Afkham Azeez <az...@wso2.com> wrote:
>
>> Is a Hazelcast cluster created per webapp, or is a single cluster shared
>> across all webapps? Why did you drop the idea of using a SessionListener &
>> SessionManager?
>>
>> On Mon, Oct 13, 2014 at 7:57 PM, Pubudu Dissanayake <pubu...@wso2.com>
>> wrote:
>>
>>> ​​
>>> Hi Azeez/Srinath
>>>
>>> I've managed to implement Tomcat Session replication using Hazelcast
>>> APIs. As per the off-line chats with Azeez and Sameera,This functionality
>>> is applicable to all web applications which are deploy in WSO2 AS. I've
>>> introduced a global web filter, which is define in the web.xml in the
>>> conf/ directory of Tomcat to have it included in all web applications
>>> deployed.
>>> As a result I've managed to replicate all the session attributes per web
>>> application. Furthermore I've tested basic auth webapp which works as
>>> expected. And I wrote a jmeter script to test session.setAttribute() by
>>> inserting 100+ records.
>>>
>>> Please advice as to how should I thoroughly test this feature.
>>>
>>> -Pubudu
>>>
>>>
>>> On Thu, Oct 2, 2014 at 11:40 AM, Afkham Azeez <az...@wso2.com> wrote:
>>>
>>>>
>>>>
>>>> On Thu, Oct 2, 2014 at 9:22 AM, Srinath Perera <srin...@wso2.com>
>>>> wrote:
>>>>
>>>>> I am not sure from notes what we decided.
>>>>>
>>>>> Cannot we just used hazelcast session replication? does above design
>>>>> you mentioned built on top of Hazelcast?
>>>>>
>>>>
>>>> Yes, the plan is to use what Hazelcast provides. Otherwise, we will
>>>> anyway have to solve all the problems the Hz implementation has solved.
>>>>
>>>>
>>>>>
>>>>> --Srinath
>>>>>
>>>>> On Wed, Oct 1, 2014 at 2:18 PM, Pubudu Dissanayake <pubu...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> Based on the Architecture review of " Tomcat session replication
>>>>>> using caching ", following aspects were discussed.
>>>>>> Participants
>>>>>>
>>>>>>    -  Azeez, Sameera , Aruna, Jayanga, Gayashan, SupunM, Niranjan
>>>>>>    and Myself
>>>>>>
>>>>>> Proposed solution. - key-val: (CarbonSessionCacheKey, Carbon
>>>>>> SessionCache)
>>>>>>
>>>>>>    - Initial implementation was based on javax.caching api's. I've
>>>>>>    created CarbonSessionCache and CarbonSessionCacheKey to maintain
>>>>>>    HttpSession in the Hazelcast distributed map. Session will be
>>>>>>    intercepted by using a Tomcat Valve.
>>>>>>    - *Verdict* on the proposed solution. - Cache map Serialization
>>>>>>    and Deserialization is very expensive operation due to heavy traffic.
>>>>>>    Therefore it is not efficient to replicate the whole session object 
>>>>>> in the
>>>>>>    cache map.
>>>>>>
>>>>>> Counter Proposed solution
>>>>>>
>>>>>>    - Having a Hazelcast map per session object. In that way if an
>>>>>>    attribute in the session changes the whole entry should not have to be
>>>>>>    replicated, only the changed attribute.
>>>>>>    - Have a per-session cache - ( session_id ).
>>>>>>    - Issue in this approach as follows
>>>>>>       - How can we acquire the session object from the map ?
>>>>>>
>>>>>> *Final verdict *on the feature implementation
>>>>>>
>>>>>>    - Instead of using the caching APIs, This needs to fix in
>>>>>>    Hazelcast level and do it in the optimal way. [1]
>>>>>>    - HazelcastWM
>>>>>>    <http://docs.hazelcast.org/docs/1.9.4/manual/html/ch08.html> [2],
>>>>>>    Bring in the filter code level in to the tomcat valve instead
>>>>>>
>>>>>> -Pubudu
>>>>>> [1] http://hazelcast.com/use-cases/web-session-clustering/
>>>>>> [2] http://docs.hazelcast.org/docs/1.9.4/manual/html/ch08.html
>>>>>>
>>>>>> On Wed, Oct 1, 2014 at 10:51 AM, Pubudu Dissanayake <pubu...@wso2.com
>>>>>> > wrote:
>>>>>>
>>>>>>> Hi Srinath
>>>>>>>
>>>>>>> Hazelcast WM allows us to cluster user http sessions automatically.
>>>>>>> Followings are required for enabling Hazelcast Session Clustering
>>>>>>> <http://hazelcast.com/use-cases/web-session-clustering/> [2][3]
>>>>>>>
>>>>>>>    - Target application or web server should support Java 1.5+
>>>>>>>    - Target application or web server should support Servlet 2.4+
>>>>>>>    spec
>>>>>>>    - Session objects that needs to be clustered have to be
>>>>>>>    Serializable
>>>>>>>
>>>>>>> Purpose of web session clustering is to replicate web session state
>>>>>>> across a distributed application servers. Benefits, allow us to scale 
>>>>>>> out
>>>>>>>  but also avoid any single point of failure and allow us to dynamically
>>>>>>> handle node failure within the application tier. performance of
>>>>>>> this web session clustering is high according to VP Hazelcast
>>>>>>> <https://www.youtube.com/watch?v=8a0LrlOIXq0>. Using Hazelcast
>>>>>>> session replication can be achieved in two different ways. Observations 
>>>>>>> as
>>>>>>> follows.
>>>>>>>
>>>>>>>    - *Hazelcast Enterprise* has native web session clustering build
>>>>>>>    in to Apache Tomcat.
>>>>>>>    - *Opensource Hazelcast* has provide a web session clustering as
>>>>>>>    an external filter, basically Hazelcast filter has to be placed 
>>>>>>> before all
>>>>>>>    of other filters and that will enable us to provide the web session
>>>>>>>    clustering in opensource. In this use case it doesn't required 
>>>>>>> changes to
>>>>>>>    application itself.
>>>>>>>
>>>>>>> [1] https://redmine.wso2.com/issues/2816
>>>>>>> [2] http://hazelcast.com/use-cases/web-session-clustering/
>>>>>>> [3]
>>>>>>> http://hazelcast.org/docs/latest/manual/html/httpsessionclustering.html
>>>>>>> [4] https://www.youtube.com/watch?v=8a0LrlOIXq0
>>>>>>>
>>>>>>> More info $subject - Web Session Clustering / Session Replication
>>>>>>> using Hazelcast
>>>>>>>
>>>>>>> -Pubudu
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Oct 1, 2014 at 10:41 AM, Srinath Perera <srin...@wso2.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> We need to use Hazelcast
>>>>>>>>
>>>>>>>> When implemented we need to test this with multilple nodes (at
>>>>>>>> least 4) and in high load conditions before it is done done.
>>>>>>>>
>>>>>>>> --Srinath
>>>>>>>>
>>>>>>>> On Wed, Oct 1, 2014 at 8:52 AM, Dinesh J Weerakkody <
>>>>>>>> dine...@wso2.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I came across this project [1] and might be useful. It is based on
>>>>>>>>> memcached library.
>>>>>>>>>
>>>>>>>>> [1] http://code.google.com/p/memcached-session-manager/
>>>>>>>>>
>>>>>>>>> On Tue, Sep 30, 2014 at 8:01 PM, Pubudu Dissanayake <
>>>>>>>>> pubu...@wso2.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi All,
>>>>>>>>>>
>>>>>>>>>> I am working on an improvement for Carbon to enable tomcat
>>>>>>>>>> session replication support using caching .Our previous
>>>>>>>>>> implementation was based on a Tomcat Valve (
>>>>>>>>>> CarbonTomcatSessionReplicationValve.java).And it was used to
>>>>>>>>>> replicate the session and adding it to cluster message.
>>>>>>>>>>
>>>>>>>>>> Http Session replication in carbon works like this (its quite
>>>>>>>>>> similar to how the same work in a standalone tomcat).
>>>>>>>>>>
>>>>>>>>>> 1. Not every webbapp session will be replicated. You need to set
>>>>>>>>>> a context property (distributable) for the webapp you need.
>>>>>>>>>> 2. Once enabled, and when the session is modified on a node, that
>>>>>>>>>> modification is sent to other nodes via a cluster message ( using
>>>>>>>>>> clustering )
>>>>>>>>>>
>>>>>>>>>> For the new implementation, initial suggestion is to use our
>>>>>>>>>> caching implementation. So we need to store the session object in 
>>>>>>>>>> the cache
>>>>>>>>>> and when session is modified, then we need to update the cache.
>>>>>>>>>>
>>>>>>>>>> Please guide me through the process what should I carried out and
>>>>>>>>>> any references to help me further to achieve [1].
>>>>>>>>>>
>>>>>>>>>> [1] https://redmine.wso2.com/issues/2816
>>>>>>>>>> ​
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *Pubudu Dissanayake*
>>>>>>>>>>  Software Engineer
>>>>>>>>>>
>>>>>>>>>> WSO2 Inc.; http://wso2.com
>>>>>>>>>> lean.enterprise.middleware
>>>>>>>>>> Mob: + 94 775 503 304
>>>>>>>>>>
>>>>>>>>>> Blog: http://geekdetected.wordpress.com/
>>>>>>>>>> Linkedin: *http://lk.linkedin.com/in/pubududissanayake*
>>>>>>>>>> <http://lk.linkedin.com/in/pubududissanayake>
>>>>>>>>>> Flickr : https://www.flickr.com/photos/pubudufx/
>>>>>>>>>> Twitter: https://twitter.com/GeekInAction
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Dev mailing list
>>>>>>>>>> d...@wso2.org
>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> *Dinesh J. Weerakkody*
>>>>>>>>> Software Engineer
>>>>>>>>> WSO2 Inc.
>>>>>>>>> lean | enterprise | middleware
>>>>>>>>> M : +94 727 361788 | E : dine...@wso2.com | W : www.wso2.com
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Dev mailing list
>>>>>>>>> d...@wso2.org
>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> ============================
>>>>>>>> Srinath Perera, Ph.D.
>>>>>>>>    http://people.apache.org/~hemapani/
>>>>>>>>    http://srinathsview.blogspot.com/
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Pubudu Dissanayake*
>>>>>>>  Software Engineer
>>>>>>>
>>>>>>> WSO2 Inc.; http://wso2.com
>>>>>>> lean.enterprise.middleware
>>>>>>> Mob: + 94 775 503 304
>>>>>>>
>>>>>>> Blog: http://geekdetected.wordpress.com/
>>>>>>> Linkedin: *http://lk.linkedin.com/in/pubududissanayake*
>>>>>>> <http://lk.linkedin.com/in/pubududissanayake>
>>>>>>> Flickr : https://www.flickr.com/photos/pubudufx/
>>>>>>> Twitter: https://twitter.com/GeekInAction
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Pubudu Dissanayake*
>>>>>>  Software Engineer
>>>>>>
>>>>>> WSO2 Inc.; http://wso2.com
>>>>>> lean.enterprise.middleware
>>>>>> Mob: + 94 775 503 304
>>>>>>
>>>>>> Blog: http://geekdetected.wordpress.com/
>>>>>> Linkedin: *http://lk.linkedin.com/in/pubududissanayake*
>>>>>> <http://lk.linkedin.com/in/pubududissanayake>
>>>>>> Flickr : https://www.flickr.com/photos/pubudufx/
>>>>>> Twitter: https://twitter.com/GeekInAction
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> ============================
>>>>> Blog: http://srinathsview.blogspot.com twitter:@srinath_perera
>>>>> Site: http://people.apache.org/~hemapani/
>>>>> Photos: http://www.flickr.com/photos/hemapani/
>>>>> Phone: 0772360902
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Afkham Azeez*
>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>> * <http://www.apache.org/>*
>>>> *email: **az...@wso2.com* <az...@wso2.com>
>>>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: *
>>>> *http://blog.afkham.org* <http://blog.afkham.org>
>>>> *twitter: **http://twitter.com/afkham_azeez*
>>>> <http://twitter.com/afkham_azeez>
>>>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez
>>>> <http://lk.linkedin.com/in/afkhamazeez>*
>>>>
>>>> *Lean . Enterprise . Middleware*
>>>>
>>>
>>>
>>>
>>> --
>>> *Pubudu Dissanayake*
>>>  Software Engineer
>>>
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>> Mob: + 94 775 503 304
>>>
>>> Blog: http://geekdetected.wordpress.com/
>>> Linkedin: *http://lk.linkedin.com/in/pubududissanayake*
>>> <http://lk.linkedin.com/in/pubududissanayake>
>>> Flickr : https://www.flickr.com/photos/pubudufx/
>>> Twitter: https://twitter.com/GeekInAction
>>>
>>>
>>
>>
>> --
>> *Afkham Azeez*
>> Director of Architecture; WSO2, Inc.; http://wso2.com
>> Member; Apache Software Foundation; http://www.apache.org/
>> * <http://www.apache.org/>*
>> *email: **az...@wso2.com* <az...@wso2.com>
>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: *
>> *http://blog.afkham.org* <http://blog.afkham.org>
>> *twitter: **http://twitter.com/afkham_azeez*
>> <http://twitter.com/afkham_azeez>
>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez
>> <http://lk.linkedin.com/in/afkhamazeez>*
>>
>> *Lean . Enterprise . Middleware*
>>
>
>
>
> --
> *Pubudu Dissanayake*
>  Software Engineer
>
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
> Mob: + 94 775 503 304
>
> Blog: http://geekdetected.wordpress.com/
> Linkedin: *http://lk.linkedin.com/in/pubududissanayake*
> <http://lk.linkedin.com/in/pubududissanayake>
> Flickr : https://www.flickr.com/photos/pubudufx/
> Twitter: https://twitter.com/GeekInAction
>
>


-- 
*Kishanthan Thangarajah*
Senior Software Engineer,
Platform Technologies Team,
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94773426635
Blog - *http://kishanthan.wordpress.com <http://kishanthan.wordpress.com>*
Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>*
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to