Cloudkit Request Per Second

Hi everyone


a little doubt


I am developing a small app, i have it in testflight and sent to a small amount of users, lets say 20 more or less.

I have tried to oversimplify the connection rate of the app to cloudkit in order to have the smallest amount of connection per second.

Nevertheless in cloudkit dashboard i have seen a spike of 3.5 request per seconds.

It's small, but considered that i have only 20 test users at the moment i am very perplexed

The application will have a future audience of 1000-2000 users (based on poll) so the limit should stay at 40 request per second in the free tier.

But if with only 20 test user i see spikes of 3.5 i suppose that i could see spikes of 150-200 request per seconds that means i will get

((200-40)/10)*100 dollars to pay monthly... am i correct?

Is this the case OR apple consider the request per seconds during the entire month?

I mean 40 request per seconds would mean 3.456.000 request per day which means 100.000.000 request (+-) during the month (30 days)

So am i safe until i reach that amount of request during the month and only after that the extra fee will be calculated?

I am a real small developer so this information for me is vital and the documentation about is really not clear at all.


Please someone, maybe from apple itself, help me understand

Accepted Reply

Again, I think the system will throttle your user's requests, not charge you.

Replies

I'm not sure you will get charged but Apple may throttle back your user requests and issue an error telling the user to try again in 5 seconds.


But why are you getting so many requests from so few users?

I'm investigating the issue, it is not really clear because i have already tried to minimize the request...

What is really annoying to me is that for everything else (storage, database, etc.) the pricing is clear, for the request is nebulous (well, we are talking about cloud service so being nebulous could be fine :-) )

Again, I think the system will throttle your user's requests, not charge you.

after a long search, in wwdc 2015 704, it states that the limit of 40conn/sec is a throttle....

why it's so hard to get clear information about this subject ? I've been the whole day searching and still so many doubts.

1) What's exactly a request? on some places I've heard it's a fetch, but then updates are not counted as requests?

2) what does it mean is throttled by the server?

3) if there's a moment my app does 100 request in a second but then it doesn't do anymore during the whole day what happens?

Something thats 100$ overcharge should me much more detailed
It’s not very clear, but the calculator at the CloudKit developer marketing page appears to explain it as, up to 400k active users, you’re limited to 40 requests per second on the total active user base. That’s further segmented to 10 requests per second per 100k active users.

So, say if you have an app where each user makes an average of 10 requests per min (0.167 req. per sec) during use, the max concurrent users you’d be able to support is 60.

(limitper100k / 0.167 = 60 )

Is that calculation correct, Apple?






Yes, the throttling aspect is my concern here.

When you look at the marketing page, the calculator prominently features '4,000,000 active users' and gives the impression that the free (and apparently only) tier can support a high volume app. But when you run the numbers on requests per second, that feels optimistic. I think many developers will be hoping to create a high traffic app, and the thought of it being throttled at the point they manage to generate some traction will give pause for thought.

It's certainly making me think twice about CloudKit – which is a shame as it looks really convenient.


Superseding my other answers and at risk of spamming the forum, here's my understanding of how this works:

The CloudKit page seems to split the usage quota into whether you are using the private or public database. Here's where I've got to.

Private Database per user quota:

As far as I can tell, this is all billed/calculated on a per user basis. As a developer, you will never be billed for usage of a user's private database. Also, If there is a group of users with crazy usage patterns, they shouldn't affect any of your other users quotas – just their own.
  • 10GB Asset Storage (Photos, Videos, etc.)

  • 100MB Data storage (Structured data in the CloudKit key-value store)

  • 2GB Data Transfer (This is unclear, but I'm assuming it's calculated per month.)

  • 40 Requests per second (I'm assuming a user will get throttled if they perform more than 3 requests in a 2 second period.)

Public Database all user quota:

Whilst Apple does provide an average 'per user' calculation in their calculator on their CloudKit page, I think this actually confuses matters.

This is because the 'per user' quota on the public database is an average based on Apple's definition of an active user – someone who has accessed your public database container within the last 16 months – rather than your typical Monthly Active Users (MAUs). This is actually a good thing, as those users that aren't retained bump up the shared allocation for your remaining users – for 16 months after they last used the app!

However, now when you create a 'per user' average of the quotas – they look more conservative than they actually are.

The truth is that for most apps usage patterns are going to vary wildly between super-engaged contributing users, casual users, and users that have churned never to return again.

With this in mind the quotas look pretty good:
  • 1PB (1000TB) Asset Storage (Photos, Videos, etc.)

  • 10TB Database Storage (Structured data in the CloudKit key-value store)

  • 200TB data transfer

  • 400 requests per second.

So, to summarise, I'd ignore the per-user average figures for the public database – they're a red herring. Do some calculations for your own app's usage patterns based on Apple's 16-month Active Users definition from the overall quota.