Can someone who knows more explain why this happen...
# help
v
Can someone who knows more explain why this happens, and could the performance of Spryker backend somehow be optimized through this? I noticed that HTTP requests to the glue api via Postman are much faster (especially locally) cf. 100ms vs 5000ms. I found such an article https://stackoverflow.com/questions/51600489/why-does-a-request-via-python-requests-takes-almost-seven-times-longer-than-in . Just only creating HTTP Connection to Spryker glue API itself takes 30-50% of the time in production environment, and 98% of the time in local environment.
Copy code
1. request duration: 5084 ms, url=/catalog-search?page=5&include=abstract-products, status=200
2. request duration: 65 ms, url=/catalog-search?page=133&include=abstract-products, status=200
3. request duration: 71 ms, url=/catalog-search?page=2&include=abstract-products, status=200
4. request duration: 67 ms, url=/catalog-search?page=17&include=abstract-products, status=200
5. request duration: 60 ms, url=/catalog-search?page=109&include=abstract-products, status=200
6. request duration: 65 ms, url=/catalog-search?page=86&include=abstract-products, status=200
7. request duration: 57 ms, url=/catalog-search?page=58&include=abstract-products, status=200
8. request duration: 59 ms, url=/catalog-search?page=56&include=abstract-products, status=200
9. request duration: 55 ms, url=/catalog-search?page=50&include=abstract-products, status=200
10. request duration: 86 ms, url=/catalog-search?page=128&include=abstract-products, status=200
b
I noticed that HTTP requests to the glue api via Postman are much faster (especially locally) cf. 100ms vs 5000ms.
It's not quite clear what are you comparing. Local vs Cloud? Or Postman vs something else? From the set of results you published (if they are from the same environment) seems like the first query is slower because the cache is not warmed up yet
v
@brave-article-83943 I'm meaning that every request I make currently from my Next.js app is as slow as the first one. So probably that also means that cache needs to warm up every single time when new fetch/axios request is made. The python example is just result example of how requests should be done and how its done in Postman.
b
@victorious-parrot-47014 if each request on your local takes ~5 seconds, make sure that you apply all these performance improvements to your local env: https://docs.spryker.com/docs/scos/dev/guidelines/performance-guidelines/general-performance-guidelines.html#hosting-recommendations. Most important are: disabling Xdebug, activating opcache, optimizing composer autoloader, class resolver cache.
So probably that also means that cache needs to warm up every single time
That should not be the case, it's enough to warm it up once with console commands or calling the endpoint