Profiling and performance montroring in NextCloud

Hi all,

I have been trying to use the NextCloud server with my application but somehow the performance numbers are not up to the expectation. Several APIs such as getting the list of files are taking up to around 5 seconds.
I have been thinking to use a profiler to see where exactly the problem is but have not been able to set it up or use it.

Following are the versions I am using:
Ubuntu: 18.04
PHP: 7.4
NextCloud: Stable18

I have tried the following:
1, Tideways
2. XDebug
3. PHPStorm

I have also used the Nextcloud monitoring app but that does not help me to see where exactly the problem is.
I am not able to profile or even debug the application.
Can someone please guide me on how to look up the issue.