REST Service - Long repsonse time

Hello again,

this time I promise it’s not a network issue :wink: I have done a lot of time measurements to figure out why it takes so long to return about 311 KB. The whole proecedure (ProcessRequest in uROBaseHTTPServer) needs an average of 1350 ms. Of these, 600 ms are needed to read and write the data into the result struct (my own BL). How can I optimize the remaining time of 750 ms? I guess within this period the process converts the data into json format, am I right? Are there any procedures (like validators) that I could save? Unfortunately, I can’t publish the current service.

My configuration looks like below:

  ServerSSLIOHandler:= TIdServerIOHandlerSSLOpenSSL.Create(nil);
  ServerSSLIOhandler.SSLOptions.RootCertFile:= 'epRoot.pem';
  ServerSSLIOhandler.SSLOptions.CertFile:= 'ep.crt';
  ServerSSLIOhandler.SSLOptions.KeyFile:= 'ep.key';
  ServerSSLIOhandler.SSLOptions.Method:= sslvSSLv23;
  ServerSSLIOhandler.SSLOptions.Mode:= sslmServer;

  FROServer:= TROIndyHTTPServer.Create(nil);
  FROServer.Port:= FPort;
  FROServer.IndyServer.IOHandler:= ServerSSLIOhandler;
  FROServer.IndyServer.OnQuerySSLPort:= ROServerQuerySSLPort;

  FROBinMessage:= TROBinMessage.Create(FROServer);
  FROBinMessage.AddServerExceptionPrefix:= false;

  FROJSONMessage:= TROJSONMessage.Create(FROServer);
  FROJSONMessage.AddServerExceptionPrefix:= false;
  FROJSONMessage.SendExtendedException:= false;

  FBinMsgDispatcher:=FROServer.Dispatchers.Add as TROMessageDispatcher;
  FBinMsgDispatcher.Message:= FROBinMessage;
  FBinMsgDispatcher.Enabled:= true;

  FJSONMsgDispatcher:= FROServer.Dispatchers.Add as TROMessageDispatcher;
  FJSONMsgDispatcher.Message:= FROJSONMessage;
  FJSONMsgDispatcher.Enabled:= true;

  FROHttpApiDispatcher:= TROHttpApiDispatcher.Create(FROServer);
  FROHttpApiDispatcher.Server:= FROServer;

  FROSessionManager:= TRODBSessionManager.Create(nil);
  FROSessionManager.ClearSessionsOnCreate:= false;
  FROSessionManager.ClearSessionsOnDestroy:= false;
  FROSessionManager.OnException:= SessionException;
  FROSessionManager.SessionDuration:= 30
 
  FHttpApiAuthenticationManager:= TROHttpApiSimpleAuthenticationManager.Create(FROServer);
  FHttpApiAuthenticationManager.SessionManager:= FROSessionManager;
  FHttpApiAuthenticationManager.SecurityMode:= smWholeServer;

  FROHttpApiDispatcher.AuthenticationManager:= FHttpApiAuthenticationManager;

  FROEventRepository:= TROInMemoryEventRepository.Create(nil);
  FROEventRepository.Message:= FROBinMessage;
  FROEventRepository.SessionManager:= FROSessionManager;

  FROServer.Active:= true;

Hi,

can you create a simple testcase, that illustrates this issue, pls?
you can send it to support@ directly

as for me, 500ms for serialization of 15000 complex records is a good result.