#1 2013-11-13 08:07:53

nirnir
Member
Registered: 2013-11-11
Posts: 66

multithread client example

I'm trying to migrate my datasnap architure to mormot .

As I understood I need a different TSQLHttpClient for each thread .
I thought of creating a stack of active clients (TSQLHttpClient ) and the thread would pop one .

In datasnap I have a CloneConnection to create the duplicates and fill my stack,
How do I do that in mormot ?

Maybe I'm going wrong way , do you have an example of multithreaded client ?

Offline

#2 2013-11-13 08:19:19

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

Re: multithread client example

Yes, TSQLHttpClient should be used thread-safe.
Or only in the main thread.

For multithreaded client sample, see "21 - HTTP Client-Server performance" and http://blog.synopse.info/post/2013/09/1 … -of-mORMot
The system is even able to serve 50000 connected clients at once (and 100 threads), with no data loss.

Offline

#3 2013-11-13 08:41:25

nirnir
Member
Registered: 2013-11-11
Posts: 66

Re: multithread client example

Thanks,
As I understand , I create the extra copies of TSQLHttpClient  the same way as the first one ,
including call to ClientSetUser with each one ?

Offline

#4 2013-11-13 16:23:04

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

Re: multithread client example

Yes.
From the server point of view, there is no difference between clients, in regard to how they are created.

Offline

#5 2013-11-13 19:51:26

nirnir
Member
Registered: 2013-11-11
Posts: 66

Re: multithread client example

Thanks.
Only one instance of TSQLModel is needed , am I right ?

Offline

#6 2013-11-13 21:44:47

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

Re: multithread client example

Yes

Offline

Board footer

Powered by FluxBB