URL Session randomly returns requests extremely slowly!

Hi,

I'm experiencing intermittent delays with URLSession where requests take 3-4 seconds to be sent, even though the actual server processing is fast. This happens randomly, maybe 10-20% of requests.

The pattern I've noticed is

  1. I create my request
  2. I send off my request using try await urlSession.data(for: request)
  3. My middleware ends up receiving this request 4-7s after its been fired from the client-side
  4. The round trip ends up taking 4-7s!

This hasn't been reproducible consistently at all on my end. I've also tried ephemeral URLSessions (so recreating the session instead of using .shared so no dead connections, but this doesn't seem to help at all)

Completely lost on what to do. Please help!

You wrote:

This happens randomly, maybe 10-20% of requests.

and also:

This hasn't been reproducible consistently at all on my end.

which has left me somewhat confused as to whether you can reproduce this in your office or not. Please clarify.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hey Quinn,

Nope - I haven't been able to reproduce consistently. It comes and goes every couple hours, but there's no specific scenario / condition / environment that I've found to reproduce this 1 for 1.

But what I have noticed is while using my application, occasionally these requests slow down a ton. I've heard this from countless other customers as well.

I'm happy to share mini-repos to reproduce the error in DMs or something - this problem has been bugging us for the past 3 weeks and we can't figure it out.

Is this on iOS?

If so, do you ever see it on the simulator?

Or if you run your iOS app on the Mac?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

URL Session randomly returns requests extremely slowly!
 
 
Q