If for whatever reason we can't separate them, we can still use Spring APIs to manage transactions manually. So, the first solution for these sorts of problems is to separate these types of I/O altogether. Mixing the database I/O with other types of I/O in a transactional context isn't a great idea. That's why we may run out of database connections - because of a slow back-end service! In that case, all Connections may wait for a response from the API call. Imagine that during this period we get a burst of calls to the initialPayment method. If the API call responds very slowly for a while, this method would hog the borrowed Connection while waiting for the response.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |