Amplitude-iOS icon indicating copy to clipboard operation
Amplitude-iOS copied to clipboard

High number of disk writes with 4.8.2

Open markuspersson opened this issue 5 years ago • 11 comments

I integrated the Amplitude SDK (4.8.2) in our iOS app a few weeks ago.

Now when I follow up on some of our performance metrics I noticed quite a dramatic change in the number of disk writes. After some investigation and running the File Activity instruments I noticed that it is the Amplitude SDK that is causing the issue.

Screenshot 2019-11-18 at 21 12 18 Screenshot 2019-11-18 at 21 26 18 Screenshot 2019-11-18 at 21 26 49

It is not a lot of data (80MB in total) but the difference is that we doubled the amount when adding Amplitude.

The screenshot with excessive writes is over a time span of 1 second. So it is quite a lot of writes during the lifetime of the application.

It would be nice if the disk writes could be batched, if they are not already. Is there anything else I could try to set on my side to make the writes happen less frequently?

markuspersson avatar Nov 18 '19 20:11 markuspersson

May I know what is the previous version you used before 4.8.2?

haoliu-amp avatar Nov 19 '19 06:11 haoliu-amp

@haoliu-amp: Sorry if I was misleading. I noticed I make it sound like there was only an issue with 4.8.2. My intention was to only mention which version we are using.

The only version we have used in our released app is 4.8.2.

markuspersson avatar Nov 19 '19 07:11 markuspersson

oh, ok, if I understand it correctly, this's your first time to use Amplitude iOS SDK, and the version is 4.8.2. Before you never used it, right?

haoliu-amp avatar Nov 19 '19 07:11 haoliu-amp

Exactly!

We integrated Amplitude two releases ago. If you look at the first graph with the disk writes. That is when it, almost, doubled in writes.

markuspersson avatar Nov 19 '19 08:11 markuspersson

The size of the writes itself is not the big issue for me. It is more that it seems to access the file system more than necessary. That is why I would like some sort of batching or similar. Or if there's anything I can do from the app perspective.

markuspersson avatar Nov 19 '19 10:11 markuspersson

Do you call logEvent a lot? Any concerns over more writes? Does it slow your app?

Batching will potentially make you losing data.

haoliu-amp avatar Nov 19 '19 23:11 haoliu-amp

Do you call logEvent a lot?

No. Currently we have a total of 15 events. One of these can be called more than once per view, but no more than 3. Most are called only once per view and some only on specific interaction.

Any concerns over more writes?

Some writes needs to happen so I assumed it would go up, but not doubled. I have already mentioned more about my concerns previously but I can also mention that we have other analytics tools that tracks exactly the same amount but without the disk writes change as much as now.

Does it slow your app?

Any writes has some impact on our performance. By running instruments Apple suggests which writes that could be improved.

Again, the amount of data is not my biggest concern, but doing almost 100 writes each second is.

markuspersson avatar Nov 20 '19 07:11 markuspersson

Hi Markus,

Each column in the picture you shared, is disk writes for one app per day, right?

You mentioned that there're other analytics tools has less writes. Can you give me an example? It will be good if they're also open sourced. Then we can take a look.

Thanks

haoliu-amp avatar Nov 20 '19 22:11 haoliu-amp

No. The disk writes is for each released version of the app to App Sore; 1.0, 2.0, 3.0, e. tc.

We have a couple of less popular ones but the bigger are: Google analytics and Firebase analytics. These have been implemented throughout each of the released versions without us seeing any high impact on disk writes.

Worth to mention is that I'm not the one to say that they actually do less disk writes or if the have some other way of accessing the file system. We haven't noticed anything in our app at least.

markuspersson avatar Nov 21 '19 10:11 markuspersson

Ok, I will spend some time to investigate. Might put this request under enhancement later.

haoliu-amp avatar Nov 21 '19 18:11 haoliu-amp

Thanks! Let me know if there’s anything else I can do to help.

markuspersson avatar Nov 21 '19 19:11 markuspersson