On Mar 5, 6:37 am, Ray Krueger <[email protected]> wrote:
> > All,
>
> > I am developing a simple web app with 2 servlets - one to process read
> > requests from memcached and one to process write requests to
> > memcached.
>
> > My question has to do with best practices on how to do this from a
> > servlet - since, at any given time, there may be a large pool of
> > running servlets..  Should each servlet *instance* initialize it's own
> > memclient?  Or can all instances of a particular servlet share a
> > memclient?  Even if they *could*, should they?  Is the memclient
> > synchronized?  Do I need to take care of synchronization myself?
>
> > As you can see, I'm looking for some tips.  I don't have a good feel
> > for what is best.  Finally, my application will only be adding things
> > to memcached and reading items from memcached - it will not be
> > *updating* items already in memcached...
>
> > Thanks for your help?
>
> Are you using memcached as a cache? Or as some kind of messaging scheme?
> Have a look at using the spymemcached libary 
> athttp://code.google.com/p/spymemcached/
> It has some very interesting 
> optimizationshttp://code.google.com/p/spymemcached/wiki/OptimizationsThis 
> might
> wiki page might answer some of your questions best.
>
> If you're using hibernate at all, you should consider using the
> hibernate-memcached library written on top of 
> spymemcached...http://code.google.com/p/hibernate-memcached/
> (shameless self promotion :P)

I'm not using it as a messaging scheme - my application will reside in
a cluster and I'd like them to share data.  I'm also not using
Hibernate for this project.  I'll take a look at the stuff you pointed
to - but I'm also still looking for some best practice information.
Anybody got some for a multi-threaded application using a memcached
client?

Thanks!

Reply via email to