If you are talking about production house porn movies then those actors are professional and that scene is divided in multiple parts which is recorded on seperate days.
Before involving in such hardcore acts some products are give to professionals performing the act which helps them to complete the task effectively.
Some of the products are throat numb spray (available in some brands on Amazon), Lignocaine gel to help stretch anal without pain and constant liquids to prevent dehydration.
Such acts are generally completed from 2 days to sometimes a week.
PS : i know all of this from interviews given by pornstars (which i don't know why the fuck i watched), i am not professional in this.
Please take advice from professionals before performing such acts.