I know this is a theorical question since i don't have code to or any logs to show, but i hope that someone can give me some idea on this question.
The problem in question was the following:
On my work, on a deploy to a production system a migration took so much time running that it failed due to a timeout and this happened on 2 tries. What's worse is that the system started to be really slow and throwing 500 error to users on the application while the running of the migration was being executed.
This happened on a production environment with load while on a testing environment the same migration runned without problems.
To give more details we are talking about a Sql server Database that can have dozens of requests on a small amount of time. And on the .NET framework API application, i created a new migration using entity framework 6 for a new table, which had foreign key constraints to other tables. Some of this related tables have hundreds of thousands of records.
For the deploy of both environments (test and production) i'm using the azure pipelines and on a specific task the migrations will run (if there is anything new for the database)
I already searched about this, but couldnt find much information, is this timeout happening because a database is with heavy load? somehow some tables can be blocked by other queries taking long? is this taking so long that it reaches the limit time allowed by migrations system? How to overcome this kind of problem? Do it off-hours only?
I appreciate the answers.