#RPC is slower than API routes

1 messages · Page 1 of 1 (latest)

pseudo hamlet
#

Hey guys, I am still facing issues with slow requests, so I made a lot of tests.

And I found that if I make the same request on RPC routes, it's about 2x slower than on API routes.

Here is an example:
/api/rpc/getUsers = 1.22s
/api/getUsers = 624ms

Is there something happening in RPC layer that could explain this?
(I removed authorizations middleware in the resolver)

tropic jacinth
pseudo hamlet
#

Ah, no I didn't know there was a blitz wrapper for api routes.
Right now, it's just normal NextJs api :

import db from "db"
import type { NextApiRequest, NextApiResponse } from "next"

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
  const data = await db.technician.findMany()

  res.status(200).json({ name: "test" })
}
pseudo hamlet
#

Ok, thanks for the link, it's night time for me now, I'll try this tomorrow first thing, thanks a lot!