First your Nextcloud 22 is End of Life. Maybe you can upgrade your Nextcloud. There are performance improvements the last releases. Upgrade to Nextcloud 25 or Nextcloud 26. Read Maintenance and Release Schedule.
And then you can read Server tuning. Maybe you can also test with a normal webserver instance on your server the performance to find out that Nextcloud is the problem or not.