Time cost suddenly increases

When I train my model, there is always some time that each epoch will cost much time (longer than 5 mins), and another period only 4 seconds.
I’m sure the running environment doesn’t change, is there any reason that will cause this phenomenon?

time%20cost1
Any suggestion would be appreciated!