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;
Result := TROHttpApiResult.Create(HTTP_200_code, id_ContentType_application_json_charset_utf8,'',false);
wb.Expression:=wb.NewBinaryExpression(wb.NewField('', 'ENTITY_ID_PK'), wb.NewConstant(ENTITY_ID_PK), dboEqual);
srcData := DASchema1.NewDataset(Connection,'ENTITY_TBL',,wb.Xml);
sjoson.WriteDataset(srcData, [ woRows], -1);
srcData := Nil;
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 ?
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?
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?
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 )?
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?
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.