I’m currently building an app that generates quotes. The total time to generate all quotes is about 10 secs, and at present provides an unacceptable user experience.
What I want to do is multi-thread each quote so the user can see results as they come in. The problem is that the app I’ve inherited does a lot of bus logic on the db.
What I’m wondering is if it’s ok to multithread each quote item, or would this cause too much load on the db server (e.g. 5 quotes = 5 threads, or threadqueueworkeritems)?
The only thing I would worry about is what “generating a quote” entails on the DB. This may involve writing to the database and if you’ve got a lot of transactional activity in there, the different quotes may compete with each other and could end up with quotes coming in series due to blocking or worse, deadlocking.
This is worst-case scenario stuff though, going from the scant details given in the question.