On Sun, 15 Feb 2015, silvioprog wrote:

Oops ... I sent an incorrect example ...

Please use this new example in attached, it is the correct example.

On Sat, Feb 14, 2015 at 11:51 PM, silvioprog <silviop...@gmail.com> wrote:
[...]
      I was able to make the example works in "enablereuse=on" mode! =)

It was not necessary to change the mycustfcgi.pas, it is the same as the 
previous
example.

This made the application more responsive, now I hold the F5 key on the browser
and I can see the millisecond changing on the screen, even with another tab
"locked" in a 10-second loop. In the first example it was not possible.

In that second example was added the "KeepConnection" property. If it is False,
the application will work as the first example that I sent: each connection is
closed in the end of request. If it is True, it will only open a new thread if
the first thread was still occupied in any processing, otherwise the
AcceptConnection of the application will be used.

I'm really impressed with the great performance achieved, please check this log
below (Chrome debug the result):

Very nice.

Some remarks:

- KeepConnection logic already existed. It is part of the fastcgi protocol.

  Normally, the apache server must send a keepconnection option as part of the 
request.
  See the 'FKeepConnectionAfterRequest' variable in TFCGIrequest, it is 
processed when
  the FCGI_BEGIN_REQUEST block comes in and is checked after each request.

  The fact that you apparently needed to introduce special processing means the 
proxy
  module does not correctly set this option. To test, you can check the value 
of the flag
  in the request handler.

  I also suggest you look at the existing implementation of KeepConnection and 
see
  where that needs to be changed, instead of introducing new KeepConnection 
handling.


- if you really need to introduce  an additional flag, please put an extra flag 
in
  ProtocolOptions. Something like 'poDefaultKeepConnection'.
  Do not introduce new booleans 'options' when an option set exists...

- Don't change the constructor signature, that is bad practice.

  A TComponent constructor must be Create(AOwner : TComponent);

  if you really want to change it, just create another one:
  Constructur CreateCustom(AOwner : TComponent; KeepConnection : Boolean);

  For components, properties must always be settable after create,
  otherwise streaming does not work correctly.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to