Performance problem upgrading an DA-server

Hi,

Try to close connection in your DoScan method

Wouldn’t work. I is not the last call - In opposite: it’s where trouble starts…

So maybe I’ve to add a new “say good by” method when the client stops and close the connection there.

On the other hand: Didn’t we have an event when the session stop? If it possible to find out, which connection is related to the session maybe we could close it here.

Additional question: Is 250 ms normal to close a connection if it is in a connection pool?

Hi,

You can use SessionManager.OnBeforeDeleteSession event and close connection before session is deleted.
in this case, you can store connection inside session.

it may depend on your database.

btw, you can close connection in background thread like

    TTask.Run(procedure
      begin
        Connection.Close;
      end);

Shouldn’t connection.close only give the connection back to the pool instead of physical closing it?

Sorry, but how to do that?

Hi,

unassigning should put connection to pool:

Connection := nil;

when you call connection.close - it closes connection physically.

something like

Session['connection'] := Connection;

Session[‘connection’] is Variant but Connection is IDAConnection.
Should that work?

yes. Variant type can store interfaces

While Delphi accepts

Session[‘connection’] := Connection

it seems that it doesn’t likes the other way. Get an

[dcc32 Fehler] fServerDataModule.pas(431): E2010 Inkompatible Typen: ‘IDAConnection’ und ‘Variant’

trying:

aCon := aSession[‘Connection’];

Delphi-Docs only speak about OLE Variants and COM Interface as far as I found so far.

I don’t see any issues with it:

Txs the IUnknown indirection does the trick :upside_down_face: