Improvement Details:
- For our GraphQL APIs, we leverage an NPM package called 'dataloader' to cache SQL query responses per request, saving time and compute for going back to the database for data that has already been loaded.
- While the PDF fill and generation APIs are not DB-intensive, there are a handful of organization and permissions checks to ensure proper access (and loading the PDF template for fill)
- The critical change here: introduce 'dataloader' to both APIs. Instead of performing SQL queries 4-6 times per request, we now only do 1.
The results:
You don't have to do anything to experience the speed improvement. If you haven't tried Anvil's PDF Fill or Gen API, what are you waiting for?