DASchema Dataset Question

Hi,

My Environment:

Windows 10
Delphi 10.4.2
RO/DA 10.0.0.1495
FB 3.0

I’ve performed a stress test on the httpapi function call.
say 10 client concurrent call the below httpapi function for each client 50 times ( total function call times is 500):

function TLoginService.getentity(const ENTITY_ID_PK: UnicodeString): Binary;
var
  srcData: IDADataset;
  sjoson:TDAJSONDataStreamer;
  wb:TDAWhereBuilder;
  nTmp:Tdatetime;
begin
  nTmp:=now;
  Result := TROHttpApiResult.Create(HTTP_200_code, id_ContentType_application_json_charset_utf8,'',false);
  wb:=TDAWhereBuilder.Create;
  wb.Expression:=wb.NewBinaryExpression(wb.NewField('', 'ENTITY_ID_PK'), wb.NewConstant(ENTITY_ID_PK), dboEqual);

  srcData := DASchema1.NewDataset(Connection,'ENTITY_TBL',[],wb.Xml);
  srcData.Open;

  sjoson:=TDAJSONDataStreamer.Create(Self);

  sjoson.Initialize(Result,aiwrite);
  try
    sjoson.WriteDataset(srcData, [ woRows], -1);
  finally
    sjoson.Finalize;
  end;
  srcData := Nil;
  FreeAndNil(wb);
  FreeAndNil(sjoson);
end;

if that DAschema contains within 10 table object , the average response time on the function call is 500 ms
however, if the DAschema contains with more dataset say 50 or more, the average response time is 3000-4500 ms.

Any Limitation on the number of DASchema DataSet/Command? As Now it seems that if DASchema contain more dataset ( over 50 dataset), the speed is slow.

How’s suggestion on this handling ?

Hi,

Try to move TDASchema from _impl to server datamodule.
it is safe in case you don’t change it, i.e. using in read-only mode.

Should this maybe be the default in templates?

Hi,
as i need each instance of that service schema using different connection manager , I cant use your method. Can I know how’s the limitation of the schema on dataset or related like command etc…?
Any suggestion on that number in case I need Each instance has its only schema?

Joe

Hi,

You can change default class factory.
for example, Pooling or Per Client class factories can be suitable for you.

I will try . As even per client, it still create that number of dataset within that service.

Now I m try to cutdown/partition the number of dataset within the service. Can I know any no of dataset is reasonable or suggested? say 30 dataset ( or related to number of column )?

Joe

Hi,

it depends on your application.
can you confirm that usage of non-default class factory solves your issue?

PerClient will allow to cache created services so 2nd and later requests from the same client should be processed faster.

My Schema is same just different connection Manager , is it still work ?
as I use onActivate event to change the Connection Manager, will it still work under cached service?

joe

Hi,

yes, it will work.
OnActivate is called in any case because in case of Pooled class factory, client can be different.

cached services mean that service itself isn’t created from scratch so Schema component is already loaded.