Hi, any plans to deploy Ory cloud in an EU datacen...
# ory-network
w
Hi, any plans to deploy Ory cloud in an EU datacenter and have it as an option in the cloud UI ? I have 350ms lag on /whoami
f
Hello! We are actually serving from the EU - what infrastructure are you on? We're also rolling out Edge Caching to make /whoami a lot faster - the feature flag will be available in the coming weeks
We're also turning up additional datacenters these days, which will also bring down latencies
w
I'm doing serverless on that site (Vercel + Ory + Hasura), but if you are on EU it's most likely the Hasura setup that is lagging
I need to add monitoring to these clients but haven't done so yet
well it's not Next/Vercel, Hasura avg response time is 30ms and didn't change much after I removed the call. And, well...
Copy code
get-ory-cookie-session: 374.511ms
hasura-jwt: 9.367ms
get-user: 62.622ms
Am I doing something wrong ?
f
what's the
Copy code
get-user: 62.622ms
call? that's internal?
w
Yes it's getting the user profile in the API as I prefer to store private user information such as external IDs there than in ory (may be a mistake but I need these fields to exist as foreign keys in the db)
Here's my code
Copy code
export async function getCookieSession(
  req: NextApiOrPageRequest
): Promise<AxiosResponse<Session>> {
  let cookieName: string = ENV.ORY_SESSION_COOKIE ?? 'ory_kratos_session'
  return (await sdk.toSession(
    undefined,
    `${cookieName}=${req.cookies[cookieName]}`
  )) as AxiosResponse<Session>
}

const sdk: ReturnType<typeof FrontendApiFactory> = FrontendApiFactory(
  new Configuration({
    basePath:
      typeof window !== 'undefined'
        ? '/api/.ory'
        : `${ENV.SERVER_APP_HOST}/api/.ory`,
    baseOptions: {
      withCredentials: true,
    },
  })
)
I fetch the cookie on the server side directly
because I need to authenticate users on pages and then I generate a jwt for the api
f
ok we'll dive into our logs to see how much is network and how much is on our end
w
it shouldn't matter much though, and the function runs on Vercel, in Frankfurt
f
yeah that should be a fast round trip
w
well, if Vercel does what it says it does 😅
f
JWTs can save you requests and latency indeed, at the cost of not being able to invalidate any time
w
that is true, I should probably let hasura authenticate with the kratos session directly
I run oathkeeper in staging but not in prod as that's not an option in ory network rn
f
So 90% latency should be <100ms on average on our end even without any edge caching