#1 2016-03-31 09:11:44

cybertrace
Member
Registered: 2016-02-29
Posts: 15

TSQLHttpServer

Hello Guys !
How many Clients can a TSQLHttpServer handle ?
I refer to sample Project31 ?

Thanks

Offline

#2 2016-03-31 09:32:39

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

Re: TSQLHttpServer

With current implementation, WebSockets uses one thread per client.
So you would be limited to around 2000 clients, I guess, under Win32, and even higher under Win64 (if the server is compiled as a 64 bit executable).
There is a http.sys-based WebSockets implementation staging, but it is not yet merged with the trunk.

For regular HTTP clients - i.e. not WebSockets - there is a thread pool so there is much less resource used.
A http.sys based HTTP server can handle 10,000 simulated connections without any problem, even under Win32.

Offline

#3 2016-03-31 13:27:31

cybertrace
Member
Registered: 2016-02-29
Posts: 15

Re: TSQLHttpServer

Thanks AB !

How is the best implementation for a purpose of a Server with many Clients ?

I'll tried Project 31 and it works nice.

Do you have a snapshot of code to use regarding the right implemetation  on Server and Client, the Client Registers a callback on the Server and then mostly receives some data

http.sys is available from Win 8 up ??

Thanks for your Help

Offline

#4 2016-03-31 16:23:26

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

Re: TSQLHttpServer

The best approach is IMHO to use interface-based services, and callbacks defined as interface parameters.
Then our binary websockets protocol, with compression and encryption enabled.

But it is a "Delphi only" approach.

What are your needs?

Offline

#5 2016-04-04 15:28:39

cybertrace
Member
Registered: 2016-02-29
Posts: 15

Re: TSQLHttpServer

Hello AB !

I need a Server what can send to the connected Clients and also the Clients can send to the Server some Information, max 4000 Bytes 1 frame. Low communication traffic. Only whe the Server sends to the Clients over their registerd callbacks maybe there is the load higher.

usage :
1. The Client connects to the Server and Registers a callback like sample 31
2. The Server sends some Information to all connected Clients as a callback, max. Clients should not be limited, up to 2000 and more (as you wrote win 32 is limited)
3. also the Client sends some Information to the Server.

I tried sample 31  and it works fine, but your answer was the resources and the limitied Count of threads, because each Client has it own thread on the Server

I tried also sample 14, but only the Client ask for the interfaced Service and then disconnects, so the Server has no Information where the Client is.

MY question

What is the easiest and best way to archieve 1..3.
What serversocket should I use and what clientsocket.

Best regards

cybertrace

Offline

#6 2016-04-04 20:42:42

emk
Member
Registered: 2013-10-24
Posts: 96

Re: TSQLHttpServer

I have similar needs that server pushes notifications to client:
My clients have a copy of the db locally and posts/takes updates thru HTTP calls to a "http.sys" server central database. My clients needs "push" from server with notification message when other clients updates the central db. (I know that mORMot has built in master/slave replication but I can't use it, because my scenario needs plain SQL exchange and some fine tunning)

I have studied the options since I have the same expectations > 2000 clients all time connected to server to get notifications: (I'm talking about notifications system only):

1. mORMmot websockets is not good since it creates one thread per socket
2. the same with all Indy libraries
3. use a standalone RabbitMQ server (or a message broker server) which easily takes millions of messages and thousands of online clients. This seems the best option, but it's a pity that Delphi doesn't have a client for AMQP protocol for exchanging messages (for STOMP protocol exists, but seems the RabbitMQ who is the "message broker of the moment" has better results with AMQP protocol).

Offline

#7 2016-04-05 12:35:22

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

Re: TSQLHttpServer

A regular http.sys server, with all clients polling the server at a regular pace (every second or ever minute), would scale with no problem.

Also try the Master/Slave replication of the framework.
See http://synopse.info/files/html/Synopse% … l#TITL_147
To scale with a lot of clients, a regular http.sys server, with on-demand RecordVersionSynchronizeSlave() from a timer would work just fine.

Do not be afraid by polling.
When the refresh rate is low (some seconds), it scales pretty well.

Offline

#8 2016-04-08 09:14:29

cybertrace
Member
Registered: 2016-02-29
Posts: 15

Re: TSQLHttpServer

Thanks emk for your Information

I checked out the RabbitMQ and there is an existing Delphi Software available named kbmMW (Kim Bo Maddsen) which has also in the professional Version an AMQP protocol, look at

http://www.blaisepascal.eu/blaisepascal … ge0020.pdf


This Autor also wrote the kbmMemtable, a very good and fast database in Memory. I used this since 2000.

Offline

#9 2016-04-08 09:21:57

emk
Member
Registered: 2013-10-24
Posts: 96

Re: TSQLHttpServer

He he, I find it myself but I didnd't have time to update here. The paper which describes the Delphi AMPQ client is here:

http://66.85.163.250/files/articles/BP37_38_AMQP.pdf

kbmMW also have their own messaging system (WIB  - publish/subcribe) which is good to use when deploy AppServer in LAN (one executable mORMot http.sys server + WIB server) - easy to make an installation script, and all the settings on default since the number of user will be small. When deploy in cloud the other scenario is good: mORMot AppServer separately and RabbitMQ+Delphi AMPQ client -  and can be made some speed optimizations conf. and installation doesn't matter because it's your server and you are in charge of.

Last edited by emk (2016-04-08 09:29:19)

Offline

#10 2016-04-11 09:02:19

dpetinov
Member
Registered: 2016-04-11
Posts: 1

Re: TSQLHttpServer

Is it possible to emulate Open Data Protocol with Mormot?

Offline

#11 2016-04-11 10:19:14

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TSQLHttpServer

I did give it a try ... have a look:
https://github.com/LongDirtyAnimAlf/OpenUI5_mORMot

Offline

#12 2016-04-27 09:54:24

cybertrace
Member
Registered: 2016-02-29
Posts: 15

Re: TSQLHttpServer

Hello Guys !

How is the best way to come over a Proxyserver with a

TSQLHttpServer as a Server and a
TSQLHttpClientWebsockets  to the Server as a client

Both or one of them could be behind a Proxyserver

I use port 8888 as in sample 31

Also a callback as in sample 31 should work

Thanks in advance

cybertrace

Offline

#13 2016-04-27 10:30:54

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

Re: TSQLHttpServer

Are you sure your proxy is able to handle WebSockets?
Most corporate proxies don't, sadly...

Offline

#14 2016-04-27 10:56:18

cybertrace
Member
Registered: 2016-02-29
Posts: 15

Re: TSQLHttpServer

Hello AB !

With Skype it is no Problem to get connetion .

I teste once the sample 31 but in out Company it did'nt work

I only have the Information

gate:8080 then user and Password

Maybe the Gateway doesn't like Websockets ??

What is an alternativ to Websockets to handle a sample like sample 31 with Client callbacks

Thanks

Offline

#15 2016-04-27 17:53:25

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

Re: TSQLHttpServer

AFAIK only long-polling is possible...

Offline

#16 2016-05-05 08:15:38

cybertrace
Member
Registered: 2016-02-29
Posts: 15

Re: TSQLHttpServer

Hello Guys !

In sample 31 how it is possible on the serverside to get an Information from what Client pseudo the message and the connectionrequest  is coming to donot send it back this message in the  Notifyevent to this Client

procedure TClientService.NewOrdersSend(const pseudo : string; var Orders : TOrderBuffer);
var i: integer;
    formattedDateTime : string;
    sMsg : string;
begin
  DateTimeToString(formattedDateTime, 'dd/mm/yyyy hh:nn:ss.zzz', Now);
//  frmServer.QueueLogMsg('Time : ' + formattedDateTime + '  came from : ' + pseudo + ' message : ' + msg);
  for ix := high(fConnected) downto 0 do // downwards for InterfaceArrayDelete()
    try
       if pseudo <> 'Master' then     //   pseudo HERE SHOULD BE THE INFORMATION FROM THE STRUCTURE OF ONE CLIENT
         fConnected[ix].NotifyOrderMsg(pseudo,Orders);
    except
      InterfaceArrayDelete(fConnected,i); // unsubscribe the callback on failure
    end;
end;

I Need here also an Information what client establishes a callback with an structure while logging on on the Server and store this information into a struct. Alos a logoncheck autentication should be made and reject in case of no license the connection

TAccountInfo  = record
         sCompanyName     :  string;
         sAccountName       :  string;
         sNameServer         :  string;
         Accountnumber     :  longint;
end;

I am not familiar with the knowledge of Interfaces and I Need your help, maybe someone can provide me with a sample like sample 31

thanks in advance

Offline

Board footer

Powered by FluxBB