Possibly this is related to ZBX-7700.
Making changes to graphs/items/triggers on a template which is linked to large numbers of hosts can take a long time. Here are a couple of examples:
1. Changing a graph item line to be a different color and changing the graph height to a different number took 40+ seconds to save. The template is inherited by around 4200 hosts
2. Adding a new trigger to a template which is linked to 4200+ hosts took around 2.5 minutes to do.
Just as in ZBX-7700, there are no DB problems. It's just ridiculously slow to do these processes. I don't have the callgraphs for these processes, but I'm willing to bet they'd see the same issues as ZBX-7700.
To make this worse, these processes cause various tables in the database to be locked while they run. For example, the hosts/items tables can get locked. Having locks prevents data from getting into the tables and creates even more slowness on the UI. Right now, I have to seriously consider doing manual database queries to make changes at times just so I don't hose the Zabbix system by doing the changes through the UI.