-------- Forwarded Message --------
From: Martin Grotzke <martin....@javakaffee.de>
To: us...@wicket.apache.org
Cc: memcached-se...@googlegroups.com
Subject: Re: Wicket clustering without web server clustering
Date: Mon, 31 May 2010 01:41:13 +0200
Hi Dmitry,
I'm cc'ing the memcached-session-manager list so that we could take this
thread over to this list...
On Sun, 2010-05-30 at 15:38 -0700, DmitryM wrote:
> Martin,
>
> Thanks a lot for the reply.
> Actually, I would appreciate if you helped me.
> I tried your tomcat session manager with my wicket app.
> I followed the configuration instructions for Tomcat you listed on the
> session manager page.
Can you post the actual configuration please?
> But it didn't seem to work for ajax requests.
> I believe I used sticky haproxy configuration (to add session id to the
> request) but it still blew up with PageExpiredException on ajax requests.
To be sure that you're sticky you can also test with just one tomcat.
Do you see anything in the logs that's helpful?
Please can you add this to $CATALINA_HOME/conf/logging.properties and
provide some log output?
de.javakaffee.web.msm.MemcachedBackupSessionManager.level = FINEST
de.javakaffee.web.msm.SessionIdFormat.level = FINEST
de.javakaffee.web.msm.NodeAvailabilityCache.level = FINEST
Btw. you should tell haproxy to consider only a part of the session-id,
as the session-id contains the memcached node encoded (like the
jvm-route), like this:
602F7397FBE4D9932E59A9D0E52FE178-n1
or
602F7397FBE4D9932E59A9D0E52FE178-n1.tc1
if you have configured a jvmroute.
Perhaps haproxy allows to set a pattern, or also the length to use
should be possible (default sessionid length is configurable in tomcat
IIRC).
>
> And there is even more significant issue: the protocol will eventually be
> secured (https) and haproxy (used in production) wouldn't be able to support
> sticky sessions in that case.
For this you should do SSL offloading in front of haproxy (stunnel?).
Are you forced to use haproxy btw? Some time ago I also looked for
alternatives to the usual suspects, and got good results with nginx
(also with SSL and sticky sessions IIRC).
Cheers,
Martin
>
> I can verify one more time my configuration (to make sure I use sticky
> sessions, sync session storage/retrieval, same request renderng etc.) and
> will let you know if it worked for me or not.
>
> Thanks,
> Dmitry
can you put the attached jar in tomcat/lib and test with this?
It's a patched session manager jar that doesn't store sessions in the
local session map at all but always retrieves it from memcached.
Also please set sessionBackupAsync="false" in the manager configuration.
I tested a very simple wicket app here with two tomcats and your
provided haproxy config (at least I used the listen part),
ONE_PASS_RENDER strategy, HttpSessionStore in newSessionStore and
basically it seems to work.
The only strangy thing I notice is that, when I access a new page the
result of the first action seemed to get lost (e.g. clicking a link
that just increments an AtomicInteger stored as field of the page).
After I changed ONE_PASS_RENDER to REDIRECT_TO_RENDER this issue was
gone.
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
What I'm wondering: how can you run it with the default rendering
mode? REDIRECT_TO_BUFFER stores rendered responses in a map stored in
the WebApplication, so such a buffered response would not be available
in another tomcat (if the redirect after the action hits a different
tomcat)?
See o.a.w.protocol.http.WebApplication.popBufferedResponse(sessionId, bufferId).
Btw, there's already an unreleased serialization strategy based on
kryo, a serialization lib that is one of the fastest according to
http://code.google.com/p/thrift-protobuf-compare/wiki/BenchmarkingV2
... and I've done my own benchmark:
http://code.google.com/p/memcached-session-manager/wiki/SerializationStrategyBenchmark
If you'll use msm I'd recommend to use this. I can send you the
unreleased jar if you want... :-)
>
> The only (most likely not related to the session manager itself) thing
> is ajax performance - it seemed to take extra 2-3 seconds (compared to
> the regular performance) for the ajax action to complete.
2-3 secs are rather long. Can you checkout jmx stats and look what msm
number are, according to
http://code.google.com/p/memcached-session-manager/wiki/JMXStatistics ?
Especially msmStatEffectiveBackupInfo and
msmStatSessionsLoadedFromMemcachedInfo are helpful here.
Also msmStatCachedDataSizeInfo is interesting...
> My guess is it may be related to the default PageStore used by the app
> (it may be a slow DiskPageStore).
So you aren't you using HttpSessionStore already?
> I will experiment with that later (may be try to use some other
> PageStore implementation, like Victor's one -
> http://letsgetdugg.com/2010/02/07/clustering-wicket-for-fun-and-profit/
> I would prefer it over Hazelcast since memcached is used by session
> manager and by Hibernate second level cache in the app, so introducing
> an extra lib would be an overhead).
Yes, looks like an interesting alternative. I've read this post these
days when it was referred by
http://wicketbyexample.com/apache-wicket-clustering-with-multiple-options/
but to me it's not an option since I need the whole session actually
for failover, not only wicket pagemaps.
If you can be sure that nothing get's stored additionally in the
session you might try to rely on this and don't use msms at all.
Plz let me know how it works for you!
Cheers,
Martin
>
> Thanks again, Martin!
> Really appreciate your job.
--
Martin Grotzke
http://www.javakaffee.de/blog/
On Thu, Jun 3, 2010 at 9:38 PM, nskmda <nsk...@gmail.com> wrote:
> Martin, here is the statistics on ajax request right after click
> (after the node was started and another node shut down):
> - initial values - all 0s
> - after ajax button click (count/min/avg/max):
> Cached Data Size info: 1/6884/6884/6884
The number of bytes sent to memcached -> 6.8kb (this is ok, not too much)
> Effective Backup Info: 1/30/30/30
The time in millis that was spent in the request thread for session
backup, so your request took 30ms longer to complete here. Also ok.
> Sessions Loaded From Memcached Info: 2/8/118/228
Two sessions were loaded from memcached, 8ms was the min time, 118 was
average, and 228 was the max time it took to load a session.
I wonder why 2 sessions were loaded from memcached. The time it took is ok IMO.
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
Can you use just HttpSessionStore to be sure that everything is just
stored in the session? And there are not other things besides
tomcat/wicket/msm are involved?
It would be cool if you could provide a simple quickstart app that
demonstrates the issue so that I could have a look at it.
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
I think the issue is that the
HttpSessionSecurityContextRepository.loadContext (called from
SecurityContextPersistenceFilter) invokes request.getSession(), before
wicket could initialize the Application ThreadLocal:
> at
> org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:
> 833)
> at
> org.springframework.security.web.context.HttpSessionSecurityContextRepository.loadContext(HttpSessionSecurityContextRepository.java:
> 82)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:
> 75)
I also had similar issues which are solved with the KryoTranscoder.
You might try this and see if it also solves this issue for you.
Just add the attached jars to $WEB-INF/lib and change the following
config attributes for the Manager:
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
customConverter="de.javakaffee.web.msm.serializer.kryo.WicketSerializerFactory,de.javakaffee.web.msm.serializer.kryo.CGLibProxySerializerFactory"
If you're using jodatime you can also add
de.javakaffee.web.msm.serializer.kryo.JodaDateTimeRegistration to the
customConverters.
> But, btw, what if your session manager deserialized session data after
> replication? Do you think it would resolve the issue with the delay
> I'm currently seeing?
I don't think this would change s.th. as the measured timings (via
jmx, the ones you provided before) are ok. Also conceptually it's not
possible, because we cannot know to which node the next request is
going. And we definitely don't want to push all sessions to all
tomcats for scalability reasons.
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
But I also think that this is not causing the 2 seconds according to
the information you provided.
Cheers,
Martin
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
Cheers,
Martin
I just cleaned up my sample wicket webapp and pushed it to github:
http://github.com/magro/msm-sample-webapp
It's configured to support non-sticky sessions and is what I use for
testing this right now.
Cheers,
Martin
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
On Fri, Jun 11, 2010 at 1:59 AM, nskmda <nsk...@gmail.com> wrote:
> I actually tried to profile the application/server.
> In the case of one node just shut down and the second node just
> brought up the delay I saw was caused by the memcached's own
> Transcoder (it took it about 1.4 sec to deserialize data from the
> session). I'm not sure if it's is actually being used by the
> JavaSerializationTranscoderFactory.
Which method took 1.4 sec?
Btw: last night I looked again at the exception you provided (NPE at
org.apache.wicket.markup.html.panel.FeedbackPanel$1.isVisible(FeedbackPanel.java:128))
and could reproduce this: There's an anonymous inner class created in
the constructor which is missing the reference to the outer class in
the deserialized form. This should work already, though I asked on the
kryo mailing list if they could have a look at this. I'll let you know
if there are any news.
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
I have an updated msm-kryo-serializer jar for you, this should fix the
issue with the NPE in FeedbackPanel$1.isVisible.
I'd be interested if you app is fine then with HttpSessionStore.
Cheers,
Martin
On Mon, Jun 14, 2010 at 7:15 PM, nskmda <nsk...@gmail.com> wrote:
> Martin,
>
>> Which method took 1.4 sec?
>
> I ran profiler again and
> mem.spy.memcached.transcoders.BaseSerializingTranscoder.decompress
> seems to use that time (or around that).
> But it doesn't look that critical.
> Probably, I misread the output of the profiler but the Transcoder
> seems to take about 2 ms (not s).
2ms are ok, so this is not be the reason for the long delay you're experiencing.
>
>> Btw: last night I looked again at the exception you provided (NPE at
>> org.apache.wicket.markup.html.panel.FeedbackPanel$1.isVisible(FeedbackPanel .java:128))
>> and could reproduce this: There's an anonymous inner class created in
>> the constructor which is missing the reference to the outer class in
>> the deserialized form. This should work already, though I asked on the
>> kryo mailing list if they could have a look at this. I'll let you know
>> if there are any news.
>
> I'm not sure what you meant saying 'should work already'. But I will
> really appreciate any new information.
If you missed my last mail (not too hard with this rather long thread
:-)): I had attached an updated version of msm-kryo-serializer, this
should fix the issue with FeedbackPanel$1.isVisible. Just add this to
WEB-INF/lib (replaces the former jar) and the NPE should be gone.
Cheers,
Martin
>
> Regards,
> Dmitry
please add
de.javakaffee.web.msm.serializer.kryo.HibernateCollectionsSerializerFactory
to the customConverter attribute and let me know if this resolves this issue.
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
agreed, because SecondLevelCacheSessionStore + DiskPageStore seem to
work fine for you it's not worth it putting that much time into this.
I'd still be interested in solving this, but for this we should have a
simple quickstart webapp that contains the important stuff and allows
to reproduce these issues. Creating this would also need time... :-)
So I hope it's working fine for you now, if there are any things to
solve let me know :-)
Cheers,
Martin
--
Martin Grotzke
http://www.javakaffee.de/blog/
> an email to memcached-session-manager+unsub...@googlegroups.com
> <mailto:memcached-session-manager+unsubscribe@googlegroups.com>.
Can you share your test app somehow on github, optimally as a sample in https://github.com/magro/memcached-session-manager/tree/master/samples?
> an email to memcached-session-...@googlegroups.com
> <mailto:memcached-session-...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "memcached-session-manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to memcached-session-...@googlegroups.com.
20-Feb-2016 09:48:46.828 FINE [http-apr-443-exec-7] de.javakaffee.web.msm.JavaSerializationTranscoder.writeAttributes storing attribute 'wicket:wicket.Title1Crate:timestamp' with value 'Sat Feb 20 09:48:46 CST 2016' <br style="color:rgb(0,0,0);font-family:Verdana,Ge
Great to hear that you solved it!
--
Thanks so much for your responses! I know that was a very old thread. I’m glad we upgraded to 1.9.1 too!
--
---
You received this message because you are subscribed to a topic in the Google Groups "memcached-session-manager" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/memcached-session-manager/zyLci-8FWBI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to memcached-session-...@googlegroups.com.