Re: Newbie design question

Dan Creswell <[email protected]> Mon, 29 Jan 2007 10:51:04 +0000
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
Hi Ashley,

Ashley Williams wrote:
> Hi,
>
> As a company we are fairly new to javaspaces and I have a design issue
> I'm hoping somebody can shed some light on. Essentially we have a
> javaspace populated with an extremely high number of entries that are
> requested from time to time by some other stateless components - and so
> we regularly read them and then pass the details on to the interested
> components. In order to do this we take advantage of the 'read multiple'
> capabilities of the gigaspaces implementation we are using. However, the
> higher the number of template matches we get the less feasible this
> approach becomes as we are holding onto a high number of entries in
> memory in one go.
>
> I can imagine a number of traditional approaches to this problem, such
> as doing many read multiples against a managable buffer size or using
> the gigaspaces specific iterator. But I can't shake the feeling that
> this isn't in the spirit of JavaSpaces as my first instinct (having read
> one JS book) would be to throw a capped number of workers at the space
> each handling one entry at a time. This also presents a few problems
> which is where you guys come in ;)
>
> 1. How do we ensure that we read each entry just the once - maybe we
> need to manage a sequence number? It would be great if there was some
> java collections equivalent library for managing distributed data
> structures so that we don't have to keep reinventing the wheel.
>
> 2. With a one worker per entry approach do folk find that threading
> performance of the JVM is an issue? We are using Java 5 at the moment.
>
> 3. Maybe I haven't got the right end of the stick after all because
> rumor has it that read multiple capabilities are being considered for
> inclusion into the JavaSpaces specification also.
>

It's not a rumour - it's happened:

http://www.dancres.org/cottage/doc/api/net/jini/space/JavaSpace05.html

....just check out the contents method.  I'd also suggest you probably
want to try caching these entry's elsewhere and have the JavaSpace ping
you with notifies so you can process updates.

Hmmm, there seem to be a lot of people that don't know about this
interface.  It's documented as part of the "What's New" section in the
Jini 2.1 Getting started page:

http://www.dancres.org/cottage/jini_index.html

Ashley, as a newbie, can you give me some insight into how you go about
looking for bits and pieces within Jini?  You've missed JavaSpace05
(probably other stuff as well) and I want to understand how we might fix
that.

> I'm not overly concerned with the gory details at the moment but any
> design pointers would be greatly appreciated!
>

You got 'em,

Dan.

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html