impress-2020/pages/api
Matchu 18bc3df6f4 Use browser pooling for /api/assetImage
I tried running a pressure test against assetImage on prod with the open-source tool `wrk`:

```
wrk -t12 -c20 -d20s --timeout 20s 'https://impress-2020-box.openneo.net/api/assetImage?libraryUrl=https%3A%2F%2Fimages.neopets.com%2Fcp%2Fitems%2Fdata%2F000%2F000%2F522%2F522756_2bde0443ae%2F522756.js&size=600'
```

I found that, unsurprisingly, we run a lot of concurrent requests, which fill up memory with a lot of Chromium instances!

In this change, we declare a small pool of 2 browser contexts, to allow a bit of concurrency but still very strictly limit how many browser instances can actually get created. We might tune this number depending on the actual performance characteristics!
2021-11-12 23:35:30 -08:00
..
allWakaValues.js Remove Waka values 2021-11-12 22:06:50 -08:00
assetImage.js Use browser pooling for /api/assetImage 2021-11-12 23:35:30 -08:00
graphql.js [WIP] API routes working for Next.js 2021-11-01 22:25:43 -07:00
outfitImage.js /api/outfitImage makes direct GQL queries 2021-11-12 21:53:22 -08:00
sendFeedback.js [WIP] API routes working for Next.js 2021-11-01 22:25:43 -07:00
uploadLayerImage.js [WIP] API routes working for Next.js 2021-11-01 22:25:43 -07:00
validPetPoses.js [WIP] API routes working for Next.js 2021-11-01 22:25:43 -07:00