#1 2017-10-08 16:13:38

dexter
Member
Registered: 2015-04-24
Posts: 53

SOA client with multiple threads

Hi,

I have a SOA server (TSQLRestServerFullMemory) which defines service IMyService as follows:

MyServer.ServiceDefine(TMyServiceImpl, [IMyService], sicShared);

I have a SOA client (TSQLHttpClient) which calls some methods of above interface periodically (1 call per second).

FClient.ServiceDefine([IMyService], sicShared);
RemoteService := FClient.Service<IMyService>;

 
When client uses only one thread to call RemoteService methods - everything works fine.
When I create 10 threads which do the same - I'm getting access violations.
 
I have tried different ways with no success:

1. use one TSQLHttpClient for all threads

2. create TSQLHttpClient for each thread

3. use sicPerThread instead of sicShared

I have a feeling that I'm missing something, but cannot figure out for couple of days already.
Any help is appreciated.

Thanks.

Offline

#2 2017-10-08 18:24:17

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: SOA client with multiple threads

Access violation of the client side?
Of course, since TSQLHttpClient is supposed to be used from a single thread.
So either you use solution 1 and a lock/mutex, or you use 2.
Solution 3 is only for server side: it makes no sense on the client side.

Offline

#3 2017-10-08 20:22:32

dexter
Member
Registered: 2015-04-24
Posts: 53

Re: SOA client with multiple threads

Sorry, forgot to mention: yes, access violation is on the client side.

Solution 1: Do You mean to put a lock/mutex for all calls to RemoteService methods?

Solution 2: Having separate TSQLHttpClient for each thread did not help. Does it need lock/mutex for RemoteService method calls as well?

Offline

Board footer

Powered by FluxBB