Git Product home page Git Product logo

Comments (11)

ojii avatar ojii commented on May 29, 2024 2
  • initialise and enter context, that creates N connections (perhaps N=1)

Did you check if APNS will just close idle connections if they're opened but then for a while no request is made?

from aapns.

dimaqq avatar dimaqq commented on May 29, 2024 1
  • initialise and enter context, that creates N connections (perhaps N=1)

Did you check if APNS will just close idle connections if they're opened but then for a while no request is made?

I've tested exponentially increasing delays between requests.
(so a connection has had a successful request, and now there's a long gap).
a 1024s idle period does not kill the connection.

I'll test a fresh unused connection being idle next.

from aapns.

ojii avatar ojii commented on May 29, 2024 1

IMHO the priorities should be:

  1. Stability (doesn't crash weirdly all the time).
  2. Throughput (doesn't crash under load and can send tons of notifications if needed).
  3. Latency (this library is such a small part of the overall latency that optimizing this last seems reasonable).

So I'd prefer a simple design (eg no background refresh because that seems like a prime source of trouble) sacrificing some performance if needed. If/once we have an actual reliable h2 client (which this library sadly never had) we can worry about latency etc.

from aapns.

takehikokodama avatar takehikokodama commented on May 29, 2024
  • exit the context, all connections are closed

In Real-time use case, when or how often does it happen?

from aapns.

dimaqq avatar dimaqq commented on May 29, 2024

@ojii indicated that he'd start the connection pool at the start of the server.
It may only be closed when the server is shutting down.
(in other words, basically never)

I figure that's a common use-case for the cloud.

from aapns.

ojii avatar ojii commented on May 29, 2024
  • a connection does not allow more than e.g. 10 concurrent requests

why? as in, why not use the max concurrency as advertised by the server

from aapns.

dimaqq avatar dimaqq commented on May 29, 2024
  • a connection does not allow more than e.g. 10 concurrent requests

why? as in, why not use the max concurrency as advertised by the server

To ensure low latency;
Somehow latency is proportional to how "busy" a connection is.

from aapns.

michaelaw320 avatar michaelaw320 commented on May 29, 2024

As far as I can see the latency difference between them are not that significant (less than 1s) the biggest latency would be from APN Server - Mobile Device itself, which can take seconds more.

I'd be in favour of N>=2 + Many streams like the Batch-use case for general use

from aapns.

dimaqq avatar dimaqq commented on May 29, 2024

re: ↑ what throughput are you thinking of? how many requests per second?

from aapns.

ojii avatar ojii commented on May 29, 2024

re: ↑ what throughput are you thinking of? how many requests per second?

that's really hard to answer. "as much as possible"/"it depends"? we never benchmarked the v1 (my custom terrible h2 client) or v2 (httpx) so I have no baseline, and as you learned, getting good numbers is almost impossible because you need lots of real devices (with a push-enabled app installed) to do much.

from aapns.

dimaqq avatar dimaqq commented on May 29, 2024

Thank you all for your input.
I've settled on naive connection pool for now.
Hopefully the pros are:

  • stability
  • durability in face of network errors
  • throughput
  • [kinda] latency, by overprovisioning pool size
    For cons, I'll open new tickets.

from aapns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.