Server performance issues with KQL requests/responses

I have a KQL request that uses toLayouts. Here’s a simplified version of the select object for it:

"select": {
	"content": "page.primary_content.toLayouts"
}

When testing this locally the performance is fine (though it’s still noticeably faster when not calling toLayouts).

However, when testing it via my production server the performance is quite bad (like 25 seconds for returning 10 entries).

This has me thinking that the issue is with my server configuration. I’ve gone over the config options numerous times, made lots of tweaks to allocate more resources and such, but the problem persists.

Any ideas?

Definitely seems to be server related, not anything specific to the toLayouts method.