I finally figured out what was going on. My solution was getting bogged down big time from the get. I supercharged the my.cnf for mysql which helped. Cleaned up duplicate indexes and added new indexes for all the inital sorts on form loads.
Converted my solution to not preload any data into the foundset. Added databaseManager.setCreateEmptyFormFoundsets() to my solution open function. This by far boosted our system to the best performance it has ever seen. I only preload selective data now through the onload event on certain forms. One of our tables that has 1.5 million records that was causing us issues when preloading is now very fast. Users can search for their desired data. As a result everything just loads alot faster with almost no lag. The link below pretty much fixed my issue. I guess 5.2.16 really wasn't the problem after all or maybe it handled things differently.
https://www.servoy.com/forum/viewtopic.php?p=81854This article literally helped supercharge my system.
So in short my solution:
1. Added databaseManager.setCreateEmptyFormFoundsets() to solution open
2. Removed duplicate indexes and added indexes for all form sorts ( Added indexes to mysql database fields that are used in the initial sort of form loads)
3 Supercharged the mysql database by tweaking the my.cnf ( Google and monitoring my database help be get this right).