Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

1042

September 16th, 2011 04:00

XAM and mutliple writes

Hi,

I'm trying to figure out what is the best way to perfomr multiple wirte to a Centera using XAM.

Lets say I've 10 thread that must write a file to a Centera.

What is the approach that will be the more efficient:

The 10 thread sharing a one and only connection ?

XSystem xsys = xamLib.connect(xri);

for (int i = 0; i < 10; i++)

{

     Creator creator = new Creator(xsys);

     creator.start();

}

Or each thread using a sperate connection:

connections = new ArrayList (10);

for (int i = 0; i < 10; i++)

{

                XSystem xsys = xamLib.connect(xri);

                connections.add(i, xsys);

}

for (int i = 0; i < 10; i++)

{

                Creator creator = new Creator(connections.get(i));

                threads.add(creator);

                creator.start();         

}

If I test the total time to perform, both are similar.

Does that means the operation are serialized at some point ?

I was think using different connections would have been quicker.

What am I getting wrong ?

Thanks in advance.

David

409 Posts

September 16th, 2011 05:00

Our best practise is that you should only make one connection and use that for all of your application threads.

For 10 threads you are not going to see much difference between 1 connection and 10 connections except in the time it takes to open 10 connections vs 1 connection.  The time to open a connection can  be expensive.

September 16th, 2011 05:00

So application that have to connect to a Centera should maintain a single connection to this Centera and use it for all (maybe concurent) write/read operations ?

409 Posts

September 16th, 2011 05:00

Yep

Almost of operations are thread safe, check the documentation it should indicate which ones aren't

September 16th, 2011 05:00

Thank you!

Regards,

David.

No Events found!

Top