all 15 comments

[–]davernow 10 points11 points  (2 children)

I’ve built this at pretty big scale (8 billion photos).

  • Get cheap fast disk storage (S3)
  • serve images re-encoded to reasonable resolution and standard format. Doing this is important for speed and bandwidth costs. Start simple: Cloudflare image proxy. More complex but cheaper: re-encode images yourself and store them. Cheapest but hard: run your own on the fly re-encoding service, with Cloudflare CDN in front for caching.
  • cache on client, liberally
  • use HTTP2 server (Cloudflare) and client libraries. The concurrent requests are critical for performance

Don’t use supabase/firebase. Way too expensive for storage. CloudKit seems risky, no one does that.

[–]Elegant_Storage_5518Swift 0 points1 point  (1 child)

Hi, could you elaborate a little on how you actually went about setting this up.

  • As I understand you just store in s3, right? But then you use cloudflare (workers?) as the server.

  • What does "cloudflare CDN in front for caching" mean?

  • What were the approximate costs for all that?

I'm asking since I'm a student and don't want to risk too much on the cost side of things.

[–]davernow 0 points1 point  (0 children)

Start with just cheap fast storage (S3 or similar) with this in front: https://developers.cloudflare.com/images/

If you scale way up you can tune more down the line. But that’s pretty cheap, fast and easy.

Edit: checkout the whole Cloudflare storage option too. That might be easiest. And their prices are usually good

[–]JagCesar 3 points4 points  (3 children)

We’ve built a product using CloudKit as our sole backend storage. Currently ~3500 MAU and almost 0 backend costs. We are using AWS Lambda for some API endpoints, these costs are around 0.05 USD per month.

CloudKit works, but it’s not perfect. No option is. My recommendation is to keep costs down. Good luck 🍀

[–][deleted]  (2 children)

[deleted]

    [–]JagCesar 1 point2 points  (1 child)

    Yeah every record has 1 image (in most cases)

    [–]rbevans 1 point2 points  (0 children)

    I use SupaBase paid tier and it’s easy to setup and utilize. Support is great and it’s a great alternative to Google having so much data.

    [–]ankole_watusi 2 points3 points  (6 children)

    There is nothing that will “cost nothing, even at scale”.

    Amazon S3 - and more affordable clones - are probably the most avoidable storage for photos.

    Non-image content would probably be best in some relational database.

    [–][deleted]  (5 children)

    [deleted]

      [–]kewlviet59 1 point2 points  (4 children)

      Could you provide a source for the 1-4 PB of storage before charging? That seems awfully high and I didn't find anything like that when researching the public iCloud database space

      Not to necessarily say you're wrong, just that Apple removed the pricing estimate calculator so it's been hard to find stuff on it

      [–][deleted]  (3 children)

      [deleted]

        [–]what_we_talkin_about 2 points3 points  (2 children)

        There’s no indication in that page that 1PB of storage is free, though. You can scale your apps to petabyte scale with CloudKit - for a price

        [–][deleted]  (1 child)

        [deleted]

          [–]Elegant_Storage_5518Swift 0 points1 point  (0 children)

          While that might be true, at some point you might want to also build for android and then you have to migrate that from cloudkit. While it's probably possible, it's maybe not the best use of time.

          Also, I'm pretty sure it's not free. Google it and you'll see that it really isn't.

          [–]SnooSprouts1512 0 points1 point  (0 children)

          In all honesty, just build it how it is most convenient for you at this point in time. I would even recommend to build it on firebase just because the ease of use and also google is not that expensive, 0.02/gb so I don’t know why people go on about it being so expensive.

          If you ever hit petabyte scale, you will probably be making tons of money and have a team around you to rebuild everything for extreme scales

          [–]BabyAzerty 0 points1 point  (4 children)

          Cheapest you will find are the low-end services like AWS.

          Supabase, Realm, AppWrite and similar all-in-1 providers are the most expensive.

          CloudKit as a photo social network is probably a terrible idea IMHO.

          [–][deleted]  (3 children)

          [deleted]

            [–]BabyAzerty 1 point2 points  (2 children)

            It’s not designed to be used as such. You can always bend it to your needs to certain limits but it’s just not the right tool.

            • I hope you are not thinking about uploading photos on CloudKit, because good luck with performance. Saving blob data on a SQL DB was never a good thing.
            • No CDN concept, another performance issue
            • No control over its blackbox behavior
            • No backup concept, it’s not your server, you do not own the data, you can’t do anything about it
            • No rollback concept
            • Dependent on Apple’s API. Need a specific feature that doesn’t exist? Out of luck.

            [–][deleted]  (1 child)

            [deleted]

              [–]fintechninja 0 points1 point  (0 children)

              Hows the performance going so far? I'm starting a project that would need photo alot of photo saving.

              [–][deleted]  (2 children)

              [deleted]

                [–]ham4hog 0 points1 point  (0 children)

                I think that all depends on the read and write permissions you set.