I just discovered Hazelcast and I'm planning to use it to build a
distributed pictures storage. Pictures are very small, less than 40 k
and I'm storing those in a DB.
I need some guidelines/help to integrate Hazelcast on top of the
existing app. The app is giving a simple API to store/retrieve/remove
a picture from db. My idea is to use Hazelcast to build of cluster of
10 machines that will store pictures. I'm thinking to use a map that
will have the key, being a GUID and value to be an instance of a
class, let's say Picture.
1) Based on my current understanding of Hazelcast I should provide
some sort of implementation to be able to take advantages of current
Hazelcast backup mechanism. Is there any API? I guess that I will need
some sort of Listener kind of API to notify when a pictures has to be
moved from one machine to the other. My plan is to keep 3 copies of
same picture.
2) Hazelcast is taking care of data partitioning. I would like to
leverage this functionality but when the Picture instance is not
stored locally on the node where the request arrived, how should I
read the data from other machine?
The classic pattern of such system are build using architectures where
there are at least 2 types of nodes in the cluster (or 2 clusters): a
tracker node and a storage node. Tracker knows where the file is
stored, so a client will talk with a tracker and tracker will return
the location that is used by client to retrieved the file. My goal is
to combine it in one type a node leveraging Hazelcast functionality.
Thanks,
Gabi
> 1) Based on my current understanding of Hazelcast I should provide
> some sort of implementation to be able to take advantages of current
> Hazelcast backup mechanism. Is there any API? I guess that I will need
> some sort of Listener kind of API to notify when a pictures has to be
> moved from one machine to the other. My plan is to keep 3 copies of
> same picture.
Backups are taken automatically by Hazelcast. You don't have to
explicitly backup things. Just set the the backup-count to 3.
For more info, check out
http://code.google.com/docreader/#p=hazelcast&s=hazelcast&t=MapBackup
> 2) Hazelcast is taking care of data partitioning. I would like to
> leverage this functionality but when the Picture instance is not
> stored locally on the node where the request arrived, how should I
> read the data from other machine?
This is done automatically too. Hazelcast knows where your picture
entries are so mapPictures.get(GUID) will return the Picture even if
it is remotely stored.
-talip
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
Yes.
> As far that I seen during testing it looks like if
> the size is over 8k, get operation is not working properly, returning a byte
> buffer damaged. If the size of the file is getting over few hundred k,
> StreamCorruptedException is thrown during de-serialization, in toObject()
> method from Serialize class. I will continue to dig into this to see if
> there is an issue in the Serialize class or in other side.
> Is there a limitation in size of the byte buffer that could be stored as
> value in a map?
8k is no problem. we tested serializing over 1MB objects with no problem.
> One work-around is to split the file in smaller chunks and use a multi-map.
> I have tried to split it in multiple chunks and use query api to get all the
> chunks from a file but I can't use it while is query only items in memory
> and not what has been persisted, as far as I understood from documentation.
> Do you have other suggestion?
I would try to see if I am able to serialize/deserialize the big
picture object to file first.
> I have seen that you are planning to provide a Build-in file storage. as far
> as I can imagine from feature name, it something similar with what I'm doing
> but with some differences. I will be glad to contribute on this feature. Let
> me know what you are planning to do regarding this feature.
sure.. that would be great. let's wait until we clarify the road-map
and execution plan for this feature.
thanks,
-talip
You are using hazelcast-client.. nice!
Can you create a simple app to reproduce the problem so that we can run it here?
Thanks,
-talip
Hi Talip,
The app is very simple. I has one class called Entry that has 3 String fields, getters and setters. It use a map<String, Entry> to store items.So, using native client API put in the map works just great. Get is not working properly, I have retested today with latest changes from trunk and I got same result.
However, today I have transformed one node in Super client and all operations put/get/remove works properly.What is your recommendation for following approach? I'm planning to build a simple REST API over HTTP that will offer GET/POST/DELETE operations. Should this server implemented as a Superclient or regular node, or using native client to interact with cluster?
Thanks,
Gabi