#1 2015-09-24 07:27:50

difr
Member
Registered: 2015-09-24
Posts: 6

advice me, please

Hello!
Quick solution needed, as usual.
Please, advice me about using parts of mORMot Framework for building of lightweight https server.
At front-end it should have https connection pool, at back-end - oracledb session pool.
Looks like this great framework meets all my needs and even much more.
Can you confirm it, please?
And I would be very grateful for some hints and/or samples for start.

Offline

#2 2015-09-24 07:46:34

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

Re: advice me, please

See http://synopse.info/files/html/Synopse% … #TITLE_250 and http://synopse.info/files/html/Synopse% … l#TITL_122 for the https server.
It handles IOCP, so could handle thousands of connections, then use a thread pool.

Then you could access to Oracle using our SynDBOracle unit, from interface-based services.
See http://synopse.info/files/html/Synopse% … ml#TITL_63
and https://tamingthemormot.wordpress.com/2 … databases/

Offline

#3 2015-09-24 09:23:12

difr
Member
Registered: 2015-09-24
Posts: 6

Re: advice me, please

ab, thanks for fast responce.
Just one clarification.
Is it possible to have 100 http connection (thread pool) at front-end and 10 db session (db session pool) at back-end?
Or only 100 -> 1 (main) or 100 -> 100 (per each)?

Offline

#4 2015-09-24 11:30:03

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

Re: advice me, please

You could have 10,000 HTTP connections, and only 1 Oracle connection, for instance.
Or 10,000 HTTP connections, and e.g. 32 Oracle connections, one per thread pool in the HTTP.

Whatever combination you need.

Offline

#5 2015-09-24 12:18:36

yoanq
Member
Registered: 2013-01-03
Posts: 24

Re: advice me, please

Hi, ab.

If I want to use the second choise (10,000 HTTP connections, and e.g. 32 Oracle connections). How I can do that?

Offline

#6 2015-09-24 12:36:43

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

Re: advice me, please

Leave the default HTTP ThreadPool to its default 32, and use TSQLDBConnectionProperties.Execute or NewThreadSafeStatementPrepared to have one connection per thread.

Then, since http.sys is IOCP based, you could have 10,0000 HTTP connections, working on the 32 threads.

Offline

#7 2015-09-24 12:41:46

yoanq
Member
Registered: 2013-01-03
Posts: 24

Re: advice me, please

Thank's ab.

Offline

#8 2015-09-24 13:41:22

difr
Member
Registered: 2015-09-24
Posts: 6

Re: advice me, please

ab wrote:

Leave the default HTTP ThreadPool to its default 32, and use TSQLDBConnectionProperties.Execute or NewThreadSafeStatementPrepared to have one connection per thread.

Then, since http.sys is IOCP based, you could have 10,0000 HTTP connections, working on the 32 threads.

And what about THttpApiServer? I didn't see any thread pool in this class.

Offline

#9 2015-09-24 13:50:02

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

Re: advice me, please

The Thread pool is defined via the ServerThreadPoolCount parameter of TSQLHttpServer.Create.
There is as many instances of THttpApiServer threads as specified by it.
32 by default.

Offline

#10 2015-09-24 14:46:23

difr
Member
Registered: 2015-09-24
Posts: 6

Re: advice me, please

ab, looking on "09 - HttpApi web server", "13 - StandAlone JSON SQL server" and If I right understood it so far.
If I'll use only THttpApiServer, I'll have only one working thread (main process) and 10,000 waiting http(s) connections.
If I need thread pool, I should use TSQLHttpServer. And these 10,000 connections will be processed by 32 (by default) threads and each of them has 1 db session.
Waiting queue is managed by os (in "http.sys").
1. Is it right?
2. Is it possible to control max count of waiting connections (10,000)?
3. What kind of TSQLRestServer should I use in TSQLHttpServer.Create if i want (at least now) custom process requests and responces content?

Offline

#11 2015-09-24 15:32:40

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

Re: advice me, please

1. Yes. But you can also create several THttpApiServer instances, pointing to the same Process method.

2. Use MaxConnections property.

3. If you want just to expose services, the SQlite3 engine is not needed: you could use a simple TSQLRestServerFullMemory.

Offline

#12 2015-09-25 10:13:18

difr
Member
Registered: 2015-09-24
Posts: 6

Re: advice me, please

ab wrote:

1. Yes. But you can also create several THttpApiServer instances, pointing to the same Process method.

And I can also call THttpApiServer.Clone(32), right?

Offline

#13 2015-09-25 11:50:56

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

Re: advice me, please

Yes, it is the same.

And a single MaxConnections call on the first THttpApiServer is enough, AFAIK.

Offline

#14 2015-09-25 12:04:35

difr
Member
Registered: 2015-09-24
Posts: 6

Re: advice me, please

It works.
ab, merci beaucoup pour le code source soigné.

Offline

Board footer

Powered by FluxBB