Try to explore the iOS WeChat file storage mechanism

Feng Dahui of Niche News posted a very interesting article two days ago, probably to discuss the possible misunderstanding of WeChat storage mechanism by a B station video. The article proposes an experimental method. When I see that there may be prizes for doing the experiment, my eyes light up. Why don’t I take this opportunity to do a few experiments and discuss the file storage mechanism of WeChat on iOS, including:

  1. Will forwarding files take up additional storage space?
  2. Will receiving the same document multiple times from the same person take up extra space?
  3. Will receiving the same document multiple times from different people take up extra space?
  4. Are there differences between WeChat and WeChat on these issues?
  5. Does the same file received by different WeChat accounts on the same phone occupy additional storage space?

The test environment is iOS 14.8.1, iPhone 11, WeChat 8.0.28. First, we delete WeChat on the phone and reinstall it. Log in with a WeChat trumpet (trumpet A). At this time, the space occupied by WeChat is a pitiful 752.2MB, of which data occupies 244.5MB. I prepared an iso image (880MB) of Ubuntu in advance. Send it to this trumpet. After downloading and restarting the phone, you can see that the space occupied by WeChat has become 1.77GB, of which data accounts for 1.26GB. The extra space is about 1GB, which may be cache other than files, other required programs and resource files.

1 WeChat before and after receiving files

Next, we officially start the experiment. We talk about forwarding the received file to three different trumpets. Restarting the phone, you can see that, as Feng Dahui expected, the storage space occupied by WeChat has not increased. Still 1.77GB (data 1.26GB). WeChat obviously does the most basic file storage and deduplication.

1 The space occupied has not changed

Next, I forwarded the file I just sent to the trumpet three times from another WeChat account. When I clicked through the newly sent file, I had an ominous feeling that I needed to accept the file. Does WeChat really receive the file again? Fortunately, when I clicked to receive the file, the file was received in an instant. Obviously, WeChat is also accompanied by deduplication on the server side. The same file on the server will not be received multiple times locally. Restarting the phone can also see that the space occupied by WeChat has not increased.

1 It seems to be re-received, but the actual space occupied has not changed significantly

According to this logic, even if the same file is forwarded to me by different people, it should not need to be downloaded repeatedly or take up extra space. I tried to forward the same document to Trumpet A with two other Trumpets (Speaker B, Trumpet C). Although it also showed that the file needs to be received, the reception was completed in an instant, just like before. After restarting the phone again, the space occupied by WeChat remains unchanged.

However, in the case verified just now, although multiple accounts are forwarded to a trumpet account, WeChat can easily be traced back on the server side, and the source of these files is the same. If each account uploads the same file, does WeChat also have the ability to remove duplicates on the server side? To this end, I log in to trumpet B and trumpet C on another Xiaomi phone, and send the same file to trumpet A. Sending files takes a long time. This seems to be enough for people to judge that WeChat probably does not have a file similar to Baidu’s network disk to judge.

Surprisingly, trumpet A still received the file in an instant. After restarting the phone, you can also see that the space occupied by WeChat has not increased significantly (total 1.83GB, data 1.32GB). This shows that at least on the server side, WeChat can indeed determine whether a file has ever been uploaded. The lack of a second transfer function similar to a network disk may be that WeChat itself does not have related functions, or that WeChat on Android needs to be optimized.

1 The actual space occupied is still only one file size

Out of curiosity, I tried to send a file with the same content but a different file name from account B to see if WeChat’s duplicate check was based on the file name or the file itself. After waiting for a long time to send, as I expected, the receiving was only done in a split second. It can be seen that WeChat’s file deduplication is based on the content, not on the name.

1 Different file names will not take up more space

The above tests are all under the same account. So, what about different accounts on the same phone? I tried to switch a WeChat account B on the phone that I just logged into account A. It can be seen that the same file received by forwarding this time needs to be received and downloaded again. Restarting the phone can also see that the occupied space of WeChat becomes 3.8G (data 3.29G). However, under this WeChat account, the same file still only needs to be downloaded and saved, and it can be saved in seconds when it is received again. At the same time, I used this WeChat account to try it out, and I found that the above WeChat file storage mechanism is also valid for WeChat.

1 It needs to be downloaded in the real world, and the space occupied is also doubled

At this point, we can basically conclude that the duplication of WeChat file storage in iOS is quite satisfactory. The same file under the same account, as long as the content is the same, only one copy will be kept locally. The direction that the WeChat team can work on in the future is to deduplicate file storage between different accounts.

It is also worth mentioning that WeChat probably actually implements deduplication at the code level, rather than relying on the CoW feature of APFS. Because even if only one copy of the space is occupied, the iPhone will repeatedly count multiple copies of a file when calculating the capacity. You can easily reproduce this Apple bug by copying and pasting the same file multiple times:

1 When will Apple release the 4T iPhone?

In my original idea, after I wrote this article, instead of getting the 500 yuan, I wanted to have a chance to communicate with Fenng and convince him that WeChat is a bad product. But then again, even if I did, it wouldn’t change the WeChat product itself and the environment in which we had to use it. What’s more, if you look at the article again, you need to prove that WeChat has not been de-duplicated in order to get the money. It’s me who didn’t judge the question carefully 😀


If you think my article is good, you are also welcome to read my two previous articles on WeChat: “WeChat Withdrawal Experiment” which is anticlimactic and “What to Do with WeChat” which tries to reduce the space occupied by WeChat.

This article is reproduced from: https://sspai.com/post/75769
This site is for inclusion only, and the copyright belongs to the original author.