Closed noctivityinc closed 2 years ago
I'm not sure if this is AR or just Rails 7 API mode being very slow in development (hopefully not in production). When I do a simple CURL statement from terminal it also seems to be taking a long time for the API server to reply. It's like it's booting up and then making the request or something - very odd as there is no log of the delay in the console.
Ok wow - I figured it out and it's NOT Rails or AR. I have an entry in my /etc/hosts
file for the local server:
127.0.0.1 sub.local
and when I use sub.local:3000
as the API base it's slow as molasses but when I go direct with localhost:3000
it's speedy. Im not a network guy so no idea why. Hopefully, this helps someone else.
anyone have the solution for this issue on production ?
We are trying out Rails 7, AR and Rails API mode and having odd results that we hope wont occur in production.
We created two blank rails apps, one with the --api option. We then added active resource to the gemfile for the consumer app and created a bunch of simple models in the API app. We then created the class files needed in the consumer app, everything very simple:
CONSUMER APP:
API APP:
When we do something like
Product.all
in the consumer app, it takes OVER 10 SECONDS before we get results!? The log for the API app is showing that it's returning results in 52ms, but the consumer app takes over 10 seconds to display anything. This is pretty universal with anything we are doing.Is this normal? Is this a local dev thing? We obviously can't proceed with this type of setup in production with these type of latency issues.
Any idea what might be going on? I'm tempted to throw up a node server to see if that fixes the issues but I have a feeling this is on the consumer side using AR, to the API server side.