What's New in CloudKit

Session 704 WWDC 2015

CloudKit is the framework that powers iCloud on iOS, OS X, and now iCloud on the web. Hear how we've been working to make CloudKit more accessible to all your users with the web services API and Javascript library. Learn about reporting available in the updated Dashboard and the new, more flexible public database storage pricing.

[Applause]

OLIVIER BONNET: Good afternoon and welcome to Session 704 What's New in CloudKit.

My name is Olivier.

I'm the Engineering Manager for the iCloud Client teams.

So a year ago we introduced CloudKits a brand new framework for you as developers to harness of the power of iCloud.

We built a number of the iOS 8 new features on top of CloudKits.

Most visibly iCloud Drive and iCloud Photo Library were built from the ground up on top of CloudKit but Mail Drop, HomeKit, Safari history syncing, and call history syncing were also using CloudKit.

So a year later, what have we seen?

We have uploaded over 240 billion records.

We saved over 250 petabytes of assets and that's coming from over 300 million users.

So really, we couldn't be happier with how this has turned out, with how reliable and stable CloudKit has been for us.

So this year, we're going to add a couple more features to that.

Notes is now using CloudKit on iOS, and OS X to synchronize your notes between your devices.

The new app we introduces yesterday, News is entirely built on the CloudKit public database.

Even the WWDC app is now using CloudKit this year.

And last but not least iCloud Backup, was ported in iOS 9 to use CloudKit.

So this is actually this one is actually a bigger deal than it seems because iCloud Backup is our biggest service in terms of number of users, amount of data, and the number of requests per seconds.

We've also heard some good feedback from you as developers.

For instance, from Hipstamatic, "With CloudKit, we were able to focus on building our app, and even squeeze in a few extras."

So that is exactly why we built CloudKit.

To enable you as developers to focus on building great apps, building awesome user experience, without having to set up a server, without having to operate it, without having to be on call 24/7.

AgileBits is using CloudKit to synchronize one password data.

They're happy with it.

Here's what they're saying: "CloudKit is very fast, efficient, and makes it easy to detect and troubleshoot errors."

Again, that was one of our design goals with CloudKit.

If there's an error in the daemon, on the network, or on the server side, we will return that error to your app and your app is in charge of handling it, retrying it, if it makes sense.

Last but not least, IconFactory: "One of the best parts about CloudKit is there's no complicated sign-in process or setup."

Again that was one of out goals.

Make it possible to enable completely seamless user experience, no account creation, no password to enter or remember.

In addition to this good feedback, we also heard some questions from you as developers.

So last year, we introduced CloudKit.

We said it was free with limits.

And so we get some questions like, okay, what does it mean?

What if my app reached the limits?

How much will I have to pay Apple?

Second question we got immediately last year is like, okay, but what about the web?

What if I have a web app and I wanted to be able to access the same data as my iOS and OS X CloudKit app.

To talk about both of those, I would like to hand it over to Eric.

Eric is the manager for the iCloud Server team.

[Applause].

ERIC KRUGLER: Thank you.

Well, thank you, Olivier.

It's terrific to be here this afternoon to talk to you about what's new in CloudKit.

Let's start by answering that first question.

What does it cost?

We are going to look at CloudKit usage and pricing but to get into that, we first need to understand the CloudKit architecture.

So when you use CloudKit, all of your data is stored in your CloudKit container.

This is the place where all of your data resides and you can store that data, in two different ways.

One is as a private database and two is as a public database.

Now a private database is the user's private data.

This example would be the iCloud Photo Library.

All the photos that you take are stored in CloudKit and accessible by the user and managed by the user, and because it's the user's private data it comes out of the user's storage quota, not the developer's.

Now when we look at the public database, this is application's public data.

A great example of this is the new News app that we just announced yesterday, where all of those news articles are actually distributed to all the news applications via CloudKit public database and because it's the application's public data this comes out of the developer's storage quota.

So when we talk about pricing and we talk about usage, we are really talking about public database usage.

So let's see what that means.

For our public database offering, we have a free offering.

We also have a fee structure if you exceed those free limits.

And we also have usage data.

Let's look at the free offering.

So you have to store assets in the cloud, and we track that and we give you ten gigabytes to start.

So if you have no users, you are just starting development, 10 gigs.

Now as your user population grows, as your application becomes more popular, we are going to grow with you and we are going to add an additional 250 megs for every single user that is using your application for free and we will grow that up to an astonishing 1 petabyte of storage.

Likewise, for the database side, where you store your record data, we will start you with 100 megs and we will grow that at 2.5 megs per user and we will go up to 10 terabytes for free.

Now in addition to storage, we also have data transfer.

So as you're uploading and downloading your assets you are consuming bandwidth and we will start you with 2 gigabytes of data transfer per month in and out.

And like the others we will grow that as you have more users.

So we will add an extra 50 megs per user per month.

And we will allow you to grow up to 200 terabytes of data transfer per month all for free.

Now for database, it's a little different.

We actually measure it on a request per second basis.

So we are going to start you at 40 requests per second, which is very large.

And just like the others, we will grow with the number of users.

And we will do that in increments of 10 requests per second for each 100,000 users up to 400 requests per second for free, and what's important to note about the request per second is that it's actually a throttle limit.

So if for some reason your application hits these limits, we will actually send you back a throttling error back to your client to tell you you've hit the limits.

And then we will talk in a bit about how to make sure that doesn't happen.

All right.

Now, if you do go over those limits, there is a way to pay for more.

And that's our public database fees.

Now, this is over and above what we give you for free.

So it's the incremental delta between what you get for free, and what you are using.

So for assets, it's $0.03 per gigabyte per month, for database, $3.00 per gig per month.

On the transfer side, for transferring assets $0.10 per gig and on the database request rates, we'll add an extra 10 requests per second for $100, and so you can increment that number up to get to the level that allows your application to work smoothly if you hit the free limits.

And, of course, push is free.

Okay? So now let's take a look at a demo of the CloudKit calculator.

This is on developer.apple.com/cloudkit.

You can play around with this if you haven't already.

I'm going to invite Ramiro Calvo to help drive, because apparently I can drive and talk at the same time.

And he's going to help us walk through this.

If you go to the calculator, you notice that right now, we have zero active users.

Okay? And the numbers that you see beneath it tell you how much storage we are getting to you for free.

For start, this matches what we just talked about.

There's 10 gigs of asset storage, 100 megs of database storage, 2 gigs of data transfer per month, and 40 requests per second.

Now let's say my application starts taking off and I have 100,000 users.

So we're going to grow that to 100,000, and you will notice we gave you a lot more storage, and if you look below at the bottom there, and Ramiro maybe you can scroll up a little bit, you're going to notice that the cost is actually $0.

Ramiro is it possible to scroll it up a little bit.

Thank you.

Okay? So we have $0 cost.

Now let's say we go up to half a million users.

Okay? Now, once again we have a lot of storage.

Now we are up to 125 terabytes.

We're still growing and the cost to you is still zero.

Let's take it to a million users.

Okay? So now we got a lot of users in here.

We got a lot of storage.

We are up to 250 terabytes of data.

Lots of requests per second.

It's still free.

Let's take it to 4 million users.

Okay. So now we are at 4 million users and you are going to see some very large numbers here.

We are up to the petabyte of storage, 10 terabytes of database storage, 200 terabytes per month of data transfer, this is a lot of data, and all of this still costs you nothing.

Now if you recall from the pricing slide, at some point, we hit a limit.

And that limit looks about right here.

You got about a petabyte of storage.

That's what we said was the max you can get to.

So, as we add more users then there must be some costs.

Let's take it to 5 million users.

And the cost here is well, it's still free.

So what's going on here?

Well, if your application on average uses less per user that we give you, it still costs you nothing.

And because it's an average, that means that some users may use more than the average, and some may use less and that's perfectly fine.

It still costs you nothing.

So we could take this all the way up to 10 million here, and demonstrate that it still costs you nothing, all right?

If you just architect your application correctly to stay within the free limits that we give you.

All right?

So that's how we calculate things, use the calculator if you would like more information.

Thanks Ramiro.

[Applause]

All right.

The next question is how do I know how much I'm using?

The CloudKit Dashboard is the place where we put this information.

The Dashboard is a web application that you get to at developer.apple.com.

It's a place that you get to look at your container and you get to do things like manage your record types, manage whether they are in development or production, and we have added some new functionality.

So if you take a look at what we've added, there's a new section called Usage.

And you can go there and take a look at how your application container is performing.

If we drill in, we have a couple of different ways to look at the data.

We can look at it at a daily level or a monthly level.

And if you look at the daily information, the very top thing on the graphs is the number of users and this is really important because we calculate how much free stuff we give you, based on the numbers you have.

So you want to look at that first.

Now, you'll also notice on the right, you have some dashed lines over this because what we are giving you is two months worth of data, the prior month and the current month.

The current month, depending on where you are at, some of that is going to be a forecast.

And we're going to forecast that for you based on the prior activity of your container.

Now, below this, is another graph, which shows our requests per second and day by day, we show you what the peak request per second we're seeing on any given day is.

Now you can also select monthly and if you choose monthly, you're going to get a 12-month view month by month of the activity of your application, and the current month is typically going to be in a forecast where it shows a dashed line and basically what we expect it's going to be for the current month.

Now, let's scroll down to look at a couple of other graphs.

Here's database storage, as well as asset storage.

And you'll notice something different here.

You will see two lines.

There's a red line on top and a yellow line just below.

The red line represents the amount of free storage that we are giving you.

And the yellow line represents how much you are actually using.

So the game all of you guys get to play is how to keep the yellow line beneath the red line, right?

The way that you can actually see this information is by clicking over here on the section on the right where the quota box is.

It's off by default.

You can just turn it on if you like.

The reason it is off by default is because we give you so much free storage, if you click that, the scale changes and basically your usage looks like a flat line relative to the amount of free storage that we give you.

So please go ahead and try that out.

So the CloudKit Dashboard provides two things.

It's a new section to keep track of usage data and also give you the free limits.

And it's available now in beta release at developer.apple.com.

So if you already have a container, you can go there today and you can see the usage data on the Dashboard.

All right.

The second question that was asked is what about web?

Well, I'm pleased to introduce you to the new CloudKit Web Services.

This is the way [Applause].

Yeah, all right!

This is the way that you can take your amazing iOS and OS X applications and you can extend them to the web.

So how does this work?

Well, first lets talk about the features.

You get a full CloudKit API via JSON and HTTPS, we also provide CloudKit JS Library which is absolutely the best way to quickly create web applications, and we provide Web Sign in with Apple ID is the way that your users will authenticate when they use your web app.

Now, how does this work?

If you look today, you'll see your application running on iOS and OS X.

It interacts with CloudKit the framework, which behind the scenes talks to our CloudKit servers.

What we have introduced today is the ability for you to create your own web application, running in a web browser and talking over JSON and HTTPS, to our CloudKit Web Services which lets you then talk to the same exact CloudKit servers that your native applications are talking to on iOS and OS X.

Now, it's important to understand about the JSON and the HTTPS piece of this, it's just a specification.

There's no code.

Effectively, it's up to you as a developer to look at that specification.

You get to construct your own end points, hitting endpoints.

You get to create your URLs and construct your JSONs that goes in the bodies that go up in a request, you get back JSON in responses, you parse that, you deal with asset uploads and downloads, retry logic and on and on.

But a much better way to do this is using the CloudKit JS framework.

CloudKit JS gives you a JavaScript API that you can use that shields you from all the complexities of the HTTPS and JSON protocol that sits behind it.

And you can use either one, but you are probably crazy if you go the other route.

So please use CloudKit JS.

So what does this give you?

Well all right, it gives you full public and private database access.

It gives you all those record applications.

It lets you upload and download assets.

It lets you execute queries.

It even lets you do subscriptions and notifications, which means that I can actually get an asynchronous event into my web application, just like you get pushes to tell you something has changed or to notify you of some other event, so you don't have to have users hitting the refresh button or pulling from your web application.

It also has user discoverability, and it has the ability to answer the question what's changed since within custom zones which gives you sync semantics.

In short, what this gives you is full compatibility and capability as what you get on the native CloudKit on iOS and OS X.

Now, CloudKit JS, as I mentioned before is the absolute best way to develop web applications.

It's a JavaScript API.

It matches the native CloudKit API as much as you can make JavaScript match Objective-C, but you know we did our best, it's pretty close.

There's no intermediate servers.

So you can create your JavaScript application and you can talk directly to the CloudKit, you know the CloudKit Web Service behind the scenes and you don't have to run your own servers or anything in the middle and it's how we built the new Notes web app that you saw demonstrated the other day.

And what I would like to do is have Ramiro Calvo join me again.

We're going to give you a demo of the new Notes web app based on CloudKit JS.

All right.

So we are going to start at icloud.com.

This is our spring board.

There's a bunch of web apps sitting here already.

You'll notice some familiar ones we have Photos and iCloud Drive.

Those are two applications that already exist on top of CloudKit.

And with iOS 9, the new Notes application is also built on CloudKit.

And so we've created a new web application that sits on top of CloudKit, and gives all of those that rich capability that you saw demonstrated at the keynote.

So Ramiro will click in.

Here's the web app.

You're going to see some great content in here.

You see images.

You can do videos.

There's check boxes.

All of these things are available in the new Notes app and they are just CloudKit assets and records.

Okay? So what we are going to do now is create a brand new node.

And since we are at the developers conference, we should probably have a what to do at the developers conference while we are here.

So let's start out with maybe one of the more important things, which is we need to make sure we attend all the after parties.

Let's get that one on the list.

Now after we get done with attending the after parties, we really need to go to developer.apple.com/cloudkit and take a look at all the amazing documentation, including this amazing presentation, where you are going to be able to find information, documentation and everything about CloudKit itself as well as the new CloudKit Web Services.

Once we get through that, we should really go off and create our first CloudKit web application.

And once we create that, well, we should basically move on and do our best to try to hit those free limits and that might actually take a while.

So I don't think we will check that one off.

But I have attended at least one party.

So I think we can check that first one off, Ramiro.

And complete this web experience.

Now, let's go over to iOS, which is an iPad, running the new Notes application.

We will open this up.

And you will see that same kitchen remodel project as we saw before.

And here's our new things to do at WWDC that we just typed.

It showed up automatically.

It's the same data, right?

It's just that we have a web interface to it, where you can have your native iOS interface to it.

Now, we will make a few more changes in here.

I have already gone to developer.apple.com.

Ramiro you have clearly developed an amazing CloudKit web app with the Notes app and why don't we now go back and take a look at the web and see what happens, you know, over there.

Now, if all things happen, you will notice everything got checked.

That was, again, that notification experience I talked about.

The notification, push notification happened.

The web application picked that up, and automatically updated itself and showed you the changes.

And that's the new Notes web app that's available on iOS 9 and icloud.com.

Thanks Ramiro.

[Applause]

ERIC KRUGLER: Now, if your users are going to use the application, they have to sign in.

And so we are going to jump right in to taking a look at what that might look like in your web application.

So, first, you need some sort of a button to ask the user to sign in.

This is your UI.

Now when the user clicks this, a new browser window is going to pop up and this browser window is owned and managed by Apple.

And this is because the ID and password is only exchanged between the user and Apple.

The developer never sees this.

And there's a few other things that show up further down on the login page.

So first, there's "Keep me signed in."

So the user can opt in to say I want to stay signed in for up to two weeks.

There's a "Forgot Apple ID or password?"

So if the user has forgotten their ID, we'll manage the whole flow of helping them to remember their password or reset it.

And finally, if the user is brand new to, you know, the Apple ecosystem, they don't have an Apple ID at all, they can create an Apple ID right here in the flow and they will get an Apple account that they can then use immediately with your application.

So the CloudKit Web Service offering includes iCloud web-only accounts what I just described, which offers 1 gig of free storage for private database usage.

And if that same user then goes to iOS or OS X and sets up their account there, it automatically upgrades to the 5 gig iCloud account immediately.

Public database usage is the same for iOS, OS X and web.

There's no difference, so a request made on the web is the same as a request made on your phone or on your Mac.

Storage is the same way.

So when you go to the storage areas or the usage information on the Dashboard, there's no distinction.

It's all put together.

We do require a comparable application for iOS or OS X.

The purpose of the Web Services is to take your amazing iOS and OS X applications and extend them to the web.

And it's available now in beta for development, releasing with iOS 9.

And that's it for CloudKit Web Services.

What I would like to do is ask Olivier to come back and close out the session.

Thank you very much.

[Applause].

OLIVIER BONNET: Thank you very much, Eric.

So that's it.

We are very excited to see what kind of application, what kind of amazing ideas you guys will build on top of CloudKits.

As Eric mentioned, we have new web page developer at apple.com/cloudkit.

It aggregates all the data we have and all the documentation, the reference library, the simple code we have on CloudKit, both the new server, web APIs, and the client framework.

In addition to the usual technical support, and forums, URLs.

If all of those fail, you can email cloudkit@apple.com for general inquiries.

We have two more sessions this week.

The first one is tomorrow and we will do a deep dive on the CloudKit JS and the Web Services API.

And then we have on Thursday at 4:30, we have CloudKit Tips and Tricks session, where we'll do a best practices, do's and don'ts and as well a couple of nice improvements we made to the client's framework in iOS 9, and OS X El Capitan.

We have a number of labs during the rest of the week.

On Wednesday, Thursday, and Friday at 9:00, we'll have client engineers.

We will have server engineers.

I promise some of them will even be awake at 9:00.

Please come and with your questions, with your ideas.

We're happy to talk about data mall, about what type of apps you guys have in mind, either using public or private databases.

Thank you very much.

Thank you for your attention.

[Applause]

Apple, Inc. AAPL
1 Infinite Loop Cupertino CA 95014 US