Thank you for your answer
I tried different -c parameters (1 to 100) and the results is exactly the
same
I tried too, to bench how many ms my AttendConnection procedure takes, and
it's always 0ms
In the main loop
ConnectionSocket.Socket := ListenerSocket.accept;
AttendConnection(ConnectionSocket);
ConnectionSocket.CloseSocket;
Between
ConnectionSocket.Socket := ListenerSocket.accept;
AttendConnection(ConnectionSocket);
It's less than 1ms
but between
ConnectionSocket.Socket := ListenerSocket.accept;
AttendConnection(ConnectionSocket);
ConnectionSocket.CloseSocket;
it's always 10ms
Thus the ConnectionSocket.CloseSocket; takes 10ms (??!!!!)
So before to try to work with thread, i would like to know if there is a
more simple solution..
2012/9/8 Arthur Pires <arthur...@gmail.com>
> How many concurrent requests (-c option) in apache ab?
> Maybe your limitation is in the thread-per-connection model.
>
> Regards,
> Arthur.
>
> On Sat, Sep 8, 2012 at 6:35 PM, Pierre-Alexandre Voye <
> ontolog...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm making a very very simple http server with synapse. I took some codes
>> examples which works sucessfully.
>> Unhappily, under windows (I'm forced to use windows, no choice), i can't
>> have more than 100 request by seconds (tested with apache ab)
>>
>> More suprisingly, the processor is sleeping when i start an ab session.
>>
>> I tried several setLinger configuration(false/true, from 2 to 20 000), it
>> did not change everything.
>>
>> Would someone has an idea to improve this ?
>>
>> Here my code :
>>
>> var
>> ErrorMsg: String;
>> ListenerSocket, ConnectionSocket: TTCPBlockSocket;
>> begin
>>
>> ListenerSocket := TTCPBlockSocket.Create;
>> ConnectionSocket := TTCPBlockSocket.Create;
>>
>> ListenerSocket.CreateSocket;
>> ListenerSocket.setLinger(true,1000);
>> ListenerSocket.bind('0.0.0.0','1500');
>> ListenerSocket.listen;
>>
>> repeat
>> if ListenerSocket.canread(1000) then
>> begin
>> ConnectionSocket.Socket := ListenerSocket.accept;
>> {WriteLn('Attending Connection. Error code (0=Success): ',
>> ConnectionSocket.lasterror); }
>> AttendConnection(ConnectionSocket);
>> ConnectionSocket.CloseSocket;
>> end;
>> until false;
>>
>> ListenerSocket.Free;
>> ConnectionSocket.Free;
>>
>>
>>
>> {Code for procedure AttendConnection : }
>>
>> procedure AttendConnection(ASocket: TTCPBlockSocket);
>> var
>> timeout: integer;
>> s: string;
>> method, uri, protocol: string;
>> OutputDataString: string;
>> ResultCode: integer;
>> begin
>> timeout := 120000;
>>
>> WriteLn('Received headers+document from browser:');
>>
>> //read request line
>> s := ASocket.RecvString(timeout);
>> WriteLn(s);
>> method := fetch(s, ' ');
>> uri := fetch(s, ' ');
>> protocol := fetch(s, ' ');
>>
>> //read request headers
>> repeat
>> s := ASocket.RecvString(Timeout);
>> WriteLn(s);
>> until s = '';
>>
>> // Now write the document to the output stream
>>
>> if uri = '/' then
>> begin
>> // Write the output document to the stream
>> OutputDataString :=
>> '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
>> + ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
>> CRLF
>> + '<html><h1>Teste</h1></html>' + CRLF;
>>
>> // Write the headers back to the client
>> ASocket.SendString('HTTP/1.0 200' + CRLF);
>> { CUT }
>>
>> // if ASocket.lasterror <> 0 then HandleError;
>>
>> // Write the document back to the browser
>> ASocket.SendString(OutputDataString);
>> end
>> else
>> ASocket.SendString('HTTP/1.0 404' + CRLF);
>> end;
>>
>>
>>
>> Thank you,
>>
>> Pierre-Alexandre
>> --
>> ---------------------
>> https://twitter.com/#!/ontologiae/
>> http://linuxfr.org/users/montaigne
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> synalist-public mailing list
>> synalist-public@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/synalist-public
>>
>>
>
>
> --
> Arthur Pires Ribeiro Silva
> Faculdade de Engenharia Elétrica
> Universidade Federal de Uberlândia
> CDS - Coordenação de Desenvolvimento de Soluções
> Algar Telecom - CTBC
> Contato: +55 (34) 9245-7474
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> synalist-public mailing list
> synalist-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
>
--
---------------------
https://twitter.com/#!/ontologiae/
http://linuxfr.org/users/montaigne
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public