Re: [Kosmosfs-users] No concurrency at all ? Why is the KfsClient a global Singleton ?
Status: Alpha
Brought to you by:
sriramsrao
From: Sriram R. <sri...@gm...> - 2008-02-28 19:59:09
|
Hello Kai, There are 2 things going on here: 1. Reason for singleton KFS client: The file descriptor returned on open etc. is with respect to a single meta server. I return an array index as the fd for a file that is opened from a metaserver. Since there is only a single KFS client object, given an fd, we know which metaserver it comes from. Now, if we want to have multiple KFS clients, then the fd needs to encode the metaserver instance that we are talking about. 2. Single serialization lock: It is true this is a limitation of the current setup. Due to time constraints, I used a single serilization lock. In the next release (0.1.3), this restriction will go away. I'll am moving to a lock per fd (to serialize all I/O on that file) and a lock to seralize all accesses to metaserver. Sriram On Thu, Feb 28, 2008 at 2:00 AM, Kai Londenberg <K.L...@li...> wrote: > Hello, > > I'm currently evaluating KosmosFs for some usage scenarios. > > Looking through the source code of KosmosFs, I noticed > that every access through a single KfsClient is guarded by a mutex. > That is, every access to Kfs through a single client is serialized. > > This is fine for me, if not for one reason - The KfsClient is a global > singleton. > > This is from KfsClient.h: > > ///\brief The KfsClient is the "bridge" between applications and the > /// KFS servers (either the metaserver or chunkserver): there can be > /// only one client per application; the client can interface with > /// only one metaserver. > > This is enforced by the fact that KfsClient has a private constructor, > and can only be accessed by using the KfsClient::Instance() Method. > > Why this limitation ? Is there any reason why I couldn't or shouldn't > create more > than one instance of KfsClient ? (For example, one per Thread, or one per > backend Meta-Server) > > Sure, it is thread safe as it is, but that is achieved by preventing > concurrency. > > with best regards, > > Kai Londenberg > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Kosmosfs-users mailing list > Kos...@li... > https://lists.sourceforge.net/lists/listinfo/kosmosfs-users > |