How to reduce API response time

How to reduse API response time,
We did not add any operation in API only return my name in response and check with the postman still they take at least 700 ms. only to return my name, this is too much as a performance point of view,
could you please help us how to reduce execution time. And one more thing I am not sure about is it correct way to load relations, to get only one or two-column value from a related object (relation is one to many), Please suggest to us how to reduce API response time.

Hello @Ayaz_Khan

Welcome to the community and thanks for trying out Backendless!

could you please provide a curl of the request? It can help us to understand what request is working slowly for you

Regards, Vlad

Hello Vlad,
Thanks for a quick reply, Please check
This api curl code
curl -X ā€œGETā€ ā€œhttps://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/2AF4D69B-4156-42FA-8C60-49CAAE0A4E48/services/ChetanService/apiTimeingCheckā€
-H ā€˜Content-Type: application/jsonā€™
-H ā€˜Accept: application/jsonā€™

I run this API in backendless multiple times to check execution time
Timing In Backendless: 1029ms
856ms
720ms
908ms
680ms
765ms
Note: we did not add any operation in this API. still, it takes this much time It should not take more than 100ms

Thanks,

In the app logs that task ends fast

12:25:53 | SERVER_CODE | INFO | [28287] Building ServerCode Model for path (/opt/backendless/repo/c3b46a6b-6793-4561-9033-3845a19ec182/files/servercode/JS/default/PRODUCTION)
12:25:53 | SERVER_CODE | INFO | [28287] ServerCode Model built in 39ms
12:25:53 | SERVER_CODE | INFO | [28287] [E0A7BB1A-7F56-2DE6-FF69-7CEBF7A63A00] [INVOKE SERVICE] services.ChetanService.apiTimeingCheck
12:25:53 | SERVER_CODE | INFO | [28287] Processing finished in 89.538ms

But the client receives a response in ~1sec and this is too long

We are looking into it, Iā€™m going to notify you once I get something

Hello Vlad,

have you found anything that can help us to resolve our timing issue?
As I have done some experiments to examine execution time with APIs,
API execution time is less in ā€œBackendless Real-time loggingā€ as compared with Postman
Please find below
myObjectId = ā€˜1F3CA447-3D02-4B75-9220-B6A14F0A3F0Eā€™ OR ā€˜25C5ACB0-B2BE-4634-92B7-225936142DAEā€™

  1. return ā€œOKā€ {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnOk/{myObjectId}
    PostMan Timing:
    1658ms
    900ms
    1526ms
    Backendless Log Timing:
    74.596ms
    41.934ms
    81.198ms
    }

  2. return user object for a single record
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnSingleRecord/{myObjectId}
    PostMan Timing:
    5457ms
    1781ms
    1581ms
    Backendless Log Timing:
    397.785ms
    278.056ms
    708.664ms
    }

  3. return user object for all records / 10 records
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnAllRecords/{myObjectId}
    PostMan Timing:
    1089ms
    2284ms
    1418ms
    Backendless Log Timing:
    600.242ms
    602.057ms
    718.785ms
    }

  4. return user object + auction object
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnTwoObject/{myObjectId}
    PostMan Timing:
    1742ms
    1940ms
    2210ms
    Backendless Log Timing:
    452.925ms
    691.911ms
    1144.316ms
    }

  5. return user object + auction object + another object
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnThreeObject/{myObjectId}
    PostMan Timing:
    1199ms
    1464ms
    1514ms
    Backendless Log Timing:
    735.083ms
    797.039ms
    3050.443ms
    }

  6. return user object + auction object + another object + another object
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnMoreThanThreeObject/{myObjectId}
    PostMan Timing:
    3224ms
    1968ms
    1989ms
    Backendless Log Timing:
    1439.754ms
    4878.033ms
    1044.751ms
    }

  7. return user object + single relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnSingleRelation/{myObjectId}
    PostMan Timing:
    1576ms
    1704ms
    1529ms
    Backendless Log Timing:
    459.142ms
    772.976ms
    553.876ms
    }

  8. return user object + two relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnTwoRelation/{myObjectId}
    PostMan Timing:
    2246ms
    1460ms
    2023ms
    Backendless Log Timing:
    510.546ms
    425.506ms
    507.489ms
    }
    9 return user object + three relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnThreeRelation/{myObjectId}
    PostMan Timing:
    3613ms
    1249ms
    2898ms
    Backendless Log Timing:
    457.082ms
    317.630ms
    891.973ms

}
10. return user object + more then three relation
{
URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnMoreThanThreeRelation/{myObjectId}
PostMan Timing:
2358ms
2551ms
1501ms
Backendless Log Timing:
1188.075ms
3749.547ms
1531.652ms
}

hello @Ayaz_Khan ,

I am sorry that you facing the issue, we still working on it, we will notify a soon as it will be fixed

1 Like

Hello,
any update on this, What happened with this issue Please help

Hi Ayaz,

For all requests you shown below, could you please provide specific cURL requests so we can run them from our sides and get the invocation times too. You can use Postman to get curl command for each referenced query.

Regards,
Mark

Hi Mark,
Please check below

  1. return ā€œOKā€ {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnOk/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnOk/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: 3114a426-35d5-c546-9f11-7bbf952605b1'
    

    }

  2. return user object for a single record
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnSingleRecord/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnSingleRecord/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: 70fc6ed0-799f-7a5b-013b-d96b54eaf794'
    

    }

  3. return user object for all records / 10 records
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnAllRecords/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnAllRecords/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: 8f7fd08a-dd20-cc59-8b01-2af89b33f8f6'
    

    }

  4. return user object + auction object
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnTwoObject/{myObjectId} 1

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnTwoObject/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: e62753c2-cf44-4c86-4969-bfc9560374a3'
    

    }

  5. return user object + auction object + another object
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnThreeObject/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnThreeObject/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: 95132c80-9c95-b75c-abb5-edf853a149f4'
    

    }

  6. return user object + auction object + another object + another object
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnMoreThanThreeObject/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnMoreThanThreeObject/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: f174a25b-c71d-a73c-b15d-4ce022a4c34c'
    

    }

  7. return user object + single relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnSingleRelation/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnSingleRelation/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: 51bbbbdf-742c-1f6b-2a54-4fc7d6b1e578'
    

    }

  8. return user object + two relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnTwoRelation/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnTwoRelation/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: 5164b281-ee25-e674-95f0-1ec17c2a4c06'
    

    }

  9. return user object + three relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnThreeRelation/{myObjectId}

     curl -X GET \
       https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnThreeRelation/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
       -H 'cache-control: no-cache' \
       -H 'postman-token: ae520009-c69d-0f60-c8ff-225eab605b24'
    

    }

  10. return user object + more then three relation
    {
    URL: https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnMoreThanThreeRelation/{myObjectId}

    curl -X GET \
      https://api.backendless.com/C3B46A6B-6793-4561-9033-3845A19EC182/27B03E79-A628-4F5F-9A8C-62C08018BBDA/services/TestingServices/returnMoreThanThreeRelation/36FFAEB3-0A66-4462-9A2A-0921D5B5FB52 \
      -H 'cache-control: no-cache' \
      -H 'postman-token: 501f7722-a511-ac69-cecd-6c34127c7fef'
    

    }

Hi Mark,
Any update on this, I provided cURL of all apis.

Hi Ayaz,

I was able to confirm that on average a round trip for an invocation takes between 600-1200 ms, while the actual invocation on the server is always less than 100ms. The team is aware of the issue and is working on it. We do not have an estimate of when it will be fixed, but it is a high-priority item.

Regards,
Mark

1 Like