Warming up your database connection to avoid long wait times on first click

HI All.

I made a discovery recently while trying to speed up a survey form I created, without having to use API option every-time some one answered a question.

The way I have set this up is that in a from if a question is answered on the click of the answer it saves to the database via a work-flow. However, I found that on the first submission of a question answer the dreaded progress blue bar at the top of the browser window took a few seconds and you had to wait for the initial save to finish before being able to move on (executing the next work-flow). But once the first save to the database all subsequent work-flows to save were almost instant.

But the first submission wait time was bad user expereince and in a real use case would result in users trying to click the next answer button multiple times because it appeared not to be working.

Noticing after the first submission it was almost instant it became clear that opening a connection to the database to first time was being managed by the platform, so I simply added a save to the required table the as soon as the form was visible.

So instead of erroneous data appearing in the database table every time some used the form I made the save meaningful - in my case a indication that the from was opened. You could also schedule an API work-flow to remove this data if you wanted to.

So why this method instead of an API work-flow (which is seamless), well its the resources it takes! The CPU on an API work-flow for the same form was 42% and the CPU usage for the method above was 28% and once you add these up for multiple survey from submissions you can see which one is going to max out the app usage first.

This method may work for you.


Thanks for the tip!

Curious though, by ‘first save’, are you referring to Creating an Item?
Or actually just the first time you make a save to something, such as ‘Current Page’s Item’?

Hi @gf_wolfer

To put in some context, I have a repeating group and in each I have a question with an answer input.

So the work-flow creates a new thing in the “Answer type” which has about half a dozen fields in the table.

So the warm up, do on repeating group load, it actually creates a new thing in the “Answer type” (table).

1 Like