202 accepted on API requests help
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
Hi, I am building a website using nextjs13, prisma on an Aws ec2 container with docker. Whenever I test my website on production sometimes some API requests will return a 202 accepted status and those requests will never be processed. I’m assuming this is because the nextjs13 thread is busy handling other api requests or other cpu intensive tasks. Though the end points I have are not really cpu intensive. I was wondering if you guys think the solution is a combination of a horizontal scaling of the nextjs containers and perhaps the offloading of some of the api work to a job queue or is there something im missing? Thank you, help would be very very much appreciated.
1 Reply
@Giant panda Hi, I am building a website using nextjs13, prisma on an Aws ec2 container with docker. Whenever I test my website on production sometimes some API requests will return a 202 accepted status and those requests will never be processed. I’m assuming this is because the nextjs13 thread is busy handling other api requests or other cpu intensive tasks. Though the end points I have are not really cpu intensive. I was wondering if you guys think the solution is a combination of a horizontal scaling of the nextjs containers and perhaps the offloading of some of the api work to a job queue or is there something im missing? Thank you, help would be very very much appreciated.
Nextjs is heavy in itself. You can opt for serverless or maybe switch to a heavier instance.
I’m assuming this issue is caused due to high cpu usage.
I’m assuming this issue is caused due to high cpu usage.