​​
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 <[email protected]> wrote:

>
>
> On Thu, Oct 2, 2014 at 9:22 AM, Srinath Perera <[email protected]> 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 <[email protected]>
>> 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, CarbonSessionCache
>>> )
>>>
>>>    - 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 <[email protected]>
>>> 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 <[email protected]>
>>>> 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 <[email protected]>
>>>>> 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 <[email protected]
>>>>>> > 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
>>>>>>> [email protected]
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> *Dinesh J. Weerakkody*
>>>>>> Software Engineer
>>>>>> WSO2 Inc.
>>>>>> lean | enterprise | middleware
>>>>>> M : +94 727 361788 | E : [email protected] | W : www.wso2.com
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> [email protected]
>>>>>> 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: **[email protected]* <[email protected]>
> * 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
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to