Caching an object across app servers

Discussion in 'Java' started by Chris, Mar 22, 2005.

  1. Chris

    Chris Guest

    What's the simplest way to cache an object and make it available across
    multiple app servers?

    Here's the problem. We have a central database which contains customer
    information. When a customer logs in, we'll hit the database once to get the
    info. After that, though, we'd like the info cached in memory.

    We have multiple app servers, and when a request comes in from a customer,
    it can hit any server. If it hits a server which is different from the one
    it previously hit, we'd like the system to query the other app servers for
    the info before it hits the central database. The amount of customer info
    could be as much as 1 mb.

    My understanding is that this is the problem that EJBs are designed to
    solve, but EJBs are really complex to implement. I'd like something really
    simple.
     
    Chris, Mar 22, 2005
    #1
    1. Advertising

  2. Chris

    Chris Smith Guest

    <"Chris" <anon>> wrote:
    > What's the simplest way to cache an object and make it available across
    > multiple app servers?
    >
    > Here's the problem. We have a central database which contains customer
    > information. When a customer logs in, we'll hit the database once to get the
    > info. After that, though, we'd like the info cached in memory.
    >
    > We have multiple app servers, and when a request comes in from a customer,
    > it can hit any server. If it hits a server which is different from the one
    > it previously hit, we'd like the system to query the other app servers for
    > the info before it hits the central database. The amount of customer info
    > could be as much as 1 mb.


    If the data in the customer object is immutable, then just cache it once
    per container. The extra overhead is nothing compared to the cost of a
    remote procedure call to retrieve the information from a common source.

    If the information you want to cache is mutable, then you're really
    stirring up a hornets nest here. What you're asking for is a
    fundamentally difficult problem. Unless you already know all of the
    issues (in which case you wouldn't be asking here), you should not try
    to write this on your own. You will mess things up badly. Perhaps look
    into JBoss TreeCache, which can provide a cache architecture across
    multiple transactions. You'll also need to familiarize yourself with
    JTA.

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Mar 22, 2005
    #2
    1. Advertising

  3. Chris

    iksrazal Guest

    "Chris" <anon> wrote in message news:<42407a57$0$5861$>...
    > What's the simplest way to cache an object and make it available across
    > multiple app servers?
    >
    > Here's the problem. We have a central database which contains customer
    > information. When a customer logs in, we'll hit the database once to get the
    > info. After that, though, we'd like the info cached in memory.
    >
    > We have multiple app servers, and when a request comes in from a customer,
    > it can hit any server. If it hits a server which is different from the one
    > it previously hit, we'd like the system to query the other app servers for
    > the info before it hits the central database. The amount of customer info
    > could be as much as 1 mb.
    >
    > My understanding is that this is the problem that EJBs are designed to
    > solve, but EJBs are really complex to implement. I'd like something really
    > simple.


    It may be a bit off the wall, but you could cache the object in LDAP -
    typically pretty fast for read operations - using java.schema . Its a
    simple solution - as opposed to caching an object across app servers.
    Setting up OpenLDAP and 10 lines of java is pretty simple and may be
    'good enough' .

    Also, worth looking into would be the ehcache project used by both
    Hibernate and Spring/acegi. Doing a quick look there is also JCACHE
    (JSR 107) and a tubine/JCS implementation.

    HTH,
    iksrazal
    http://www.braziloutsource.com/
     
    iksrazal, Mar 23, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S3VsZGVlcA==?=

    Single-Signin across servers in same domain

    =?Utf-8?B?S3VsZGVlcA==?=, Nov 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    539
    =?Utf-8?B?S3VsZGVlcA==?=
    Nov 5, 2004
  2. RichardF
    Replies:
    2
    Views:
    41,224
    James jameson
    Apr 16, 2008
  3. =?Utf-8?B?Q0c=?=

    ASP.Net State Management across Web Servers

    =?Utf-8?B?Q0c=?=, Jan 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    300
    Kevin Spencer
    Jan 13, 2005
  4. Larry Page
    Replies:
    1
    Views:
    643
    Robbe Morris [C# MVP]
    Sep 16, 2005
  5. =?Utf-8?B?Q2hyaXMgRmluaw==?=

    Master Pages: Sharing Across Web Servers

    =?Utf-8?B?Q2hyaXMgRmluaw==?=, Feb 27, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    405
    =?Utf-8?B?Q2hyaXMgRmluaw==?=
    Feb 28, 2006
Loading...

Share This Page