+ Start a Discussion
mc1392mc1392 

multithreaded java to salesforce

All,

 

is it possible to open a session to salesforce, set binding.maintainsession, then open several threads to load data?

Right now it looks as if I woul have to create different id's to load from different machines/fork the process.

 

Any ideas in if multithreading is available on sfdc?

Best Answer chosen by Admin (Salesforce Developers) 
mpiercempierce

I've had no problems splitting work across multiple threads. Simply have each thread open its own connection and draw from a shared pool of work to be done. Multithreading is not inherently a problem.

 

There is a limit on the max number of concurrent API calls that varies with each organization type: http://www.salesforce.com/us/developer/docs/api/Content/implementation_considerations.htm#sforce_api_rate_metering

 

That may be the issue that you were thinking of, but that issue is independent of whether parallelization is achieved with multiple processes or multiple threads.

All Answers

mpiercempierce
Open multiple connections (one for each thread).
Rick.BanisterRick.Banister

I was told by Salesforce.com technical support that multithreading within a single JVM doesn't work. You'd have to have a separate JVM for each session, with 5 max per Salesforce user, 50 API sessions max if you use 10 different users. That would involve the multiple sessions each being started separately and talking to the master session. Too bad, since the only way to get really hot performance is to do separate sessions.

 

We have solved this for uploads to Salesforce in Relational Junction by providing key range selection, so you can run separate sessions, which each only look at a slice of the data. It works pretty well. Contact me if you want to know more. 

mpiercempierce

I've had no problems splitting work across multiple threads. Simply have each thread open its own connection and draw from a shared pool of work to be done. Multithreading is not inherently a problem.

 

There is a limit on the max number of concurrent API calls that varies with each organization type: http://www.salesforce.com/us/developer/docs/api/Content/implementation_considerations.htm#sforce_api_rate_metering

 

That may be the issue that you were thinking of, but that issue is independent of whether parallelization is achieved with multiple processes or multiple threads.

This was selected as the best answer