https://discord.cloudflare.com logo
Join Discord
Powered by
# r2
  • p

    Peps

    04/08/2022, 6:40 PM
    Ah, thought R2 wasn't added yet to the terms
  • b

    Ben Hong

    04/09/2022, 2:04 AM
    Has anyone tested the difference in TTFB between R2 and KV?
  • h

    hannes

    04/09/2022, 5:36 PM
    R2 could perform much better for worst case scenarios I think, KV has only 2 masters (Europe and US) and if your stuff isn't cached in the datacenter the first fetch travels to those, people measured 400ms+ latency in some cases.. I guess R2 is architected much more distributed, "cold cache" should perform better (I hope).. but just a guess
  • b

    Ben Hong

    04/10/2022, 3:14 AM
    Woah that's great. So in which situations would we use KV, which charges $5 per GB?
  • s

    Stew

    04/10/2022, 11:00 AM
    KV charges $0.50 per GB, not $5
  • b

    Ben Hong

    04/10/2022, 11:00 AM
    Whoops my bad
  • b

    Ben Hong

    04/10/2022, 11:06 AM
    Still, R2 is priced at $0.015 per GB, which is 1/30th of the price. If it does perform better than KV, when is KV a good idea?
  • s

    Stew

    04/10/2022, 11:09 AM
    R2 is still a while away and even the dev team doesn't know what the final performance metrics will be for it under production load levels, so if you're basing it purely on that it's better to wait and see.
  • b

    Ben Hong

    04/10/2022, 11:19 AM
    Alright, thanks.
  • i

    itsmatteomanf

    04/10/2022, 12:09 PM
    KV is a different class of product, though. It's a distributed KV datastore, with some specific performance guarantees.
  • b

    Ben Hong

    04/10/2022, 12:31 PM
    I was thinking about storing a small number of images (several thousand), so either R2 and KV could be used. I'm wondering which would be better for frequently accessed small blobs?
  • i

    itsmatteomanf

    04/10/2022, 2:02 PM
    If you handle files, provided both are available, R2 is decidedly better suited (with caching added). KV requires base64 transformations, etc. which are a pain. Plus it’s more expensive.
  • b

    Ben Hong

    04/10/2022, 2:05 PM
    I'm pretty sure you can put and read streams and blobs directly into and from KV, and also use the cache api with it
  • i

    Isaac McFadyen | YYZ01

    04/10/2022, 2:06 PM
    Yeah, Matteo was just saying that if you used R2 that you'd need cache as well. Not that KV doesn't have cache.
  • b

    Ben Hong

    04/10/2022, 2:08 PM
    Ok cool. So then which would be faster on a cache miss?
  • i

    Isaac McFadyen | YYZ01

    04/10/2022, 2:10 PM
    Not sure, there's not many benchmarks around quite yet 😄
  • i

    Isaac McFadyen | YYZ01

    04/10/2022, 2:11 PM
    But R2 is more distributed than KV AFAIK. Not really much public info but I believe it's a bit more distributed than KV which only has US and Europe central locations.
  • b

    Ben Hong

    04/10/2022, 2:12 PM
    Alright, thanks!
  • w

    Walshy | Pages

    04/10/2022, 2:26 PM
    R2 is still being very actively worked on so cold read benchmarks aren't very representative currently. Since you'll have a Worker invokation either way (to grab from KV or cache R2) then R2 is probably the better choice. I do love KV though so you should also try that and just see which you prefer :p
  • b

    Burrito

    04/10/2022, 2:58 PM
    Pages are currently built on top of KV, will it get any benefit from moving to R2?
  • h

    HardAtWork

    04/10/2022, 6:21 PM
    (Speculation Inbound)Pages might benefit from moving some assets to R2, such as large downloadable files, images, audio, other assets etc., but for most things such as CSS/HTML/JS bundles, KV will always be faster to read from, and thus the go-to for most assets. But, this is totally up to the team, so we will see where it goes.
  • l

    lmtr0

    04/10/2022, 6:26 PM
    ^^
  • b

    Burrito

    04/10/2022, 6:27 PM
    Why is it that smaller items are faster in KV than R2?
  • b

    Burrito

    04/10/2022, 6:28 PM
    In my head each data center should have their own cache anyways, KV or R2.
  • h

    HardAtWork

    04/10/2022, 8:13 PM
    Copy-Pasted As far as I’ve seen from people testing it, and from intentions I have heard from the team, KV will still be(not accounting for the cache) the go to for DB-like and small files, as it’s underlying infrastructure makes it lightning fast to pull from origin colos. But, because of the way it is optimized, it just cannot support very large values at scale, so that is where R2 is better. But, as I said, just what I have scraped together, and may not actually be what is intended.
  • b

    Burrito

    04/10/2022, 8:15 PM
    Oh I'm talking specifically in the context of Pages.
  • b

    Burrito

    04/10/2022, 8:16 PM
    My assumption would be, past the first fetch, KV or R2 both will be cached in data centers anyways so there's no performance difference
  • b

    Burrito

    04/10/2022, 8:17 PM
    So I'm thinking Pages could leverage R2 and relax the file size and file count limit.
  • h

    HardAtWork

    04/10/2022, 8:19 PM
    File size limits could probably be increased, if not removed, by storing larger files in R2. The difficulty is that it looks like cold-read times for R2 are and will remain higher than KV, and thus the smaller files will probably still be stored in KV, even if others will utilizes the larger file limits of R2.
  • b

    Burrito

    04/10/2022, 8:22 PM
    This seems to suggest the opposite?
1...192021...1050Latest