@joeyk, thank you for your reply. Like you suggested I found some resources and will try a couple of things.
These resources are:
https://mtcextendee.com/2019/12/25/mautic-are-very-slow-15m-contacts/
However I fail to see how installing stuff in a container would help (like it suggested in the post you mentioned). I will try some of the things I posted above first and hopefully get the results I am looking for.
Have a nice day.