V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jgh004
V2EX  ›  程序员

微软的新项目 Garnet 碾压 Redis ?

  •  2
     
  •   jgh004 · 37 天前 · 9571 次点击
    这是一个创建于 37 天前的主题,其中的信息可能已经有所发展或是发生改变。

    吹的很牛 b, 但它毕竟是 c#写的,能干过 Redis 么?

    附上项目地址 https://github.com/microsoft/garnet

    72 条回复    2024-03-29 17:57:18 +08:00
    luojianxhlxt
        1
    luojianxhlxt  
       37 天前
    研究了下,只有 db0 ,不知道是不是我不会用。。。
    chendy
        2
    chendy  
       37 天前
    内存集中的东西用带 gc 的语言总觉得不是很靠谱(但是我只写过 java ,c#啥机制不熟,但是目测也是带 gc 的吧)
    但是如果考虑大集群之类的又觉得好像还行?…
    des
        3
    des  
       37 天前   ❤️ 1
    哪里说“碾压”了?
    netnr
        4
    netnr  
       37 天前 via Android
    @chendy #2 引用了 unsafe
    Trim21
        5
    Trim21  
       37 天前 via Android
    @des benchmark 里
    bthulu
        6
    bthulu  
       37 天前   ❤️ 1
    这真是个好东西. 我司所有服务器跑的都是 windows, redis 还一直用的微软的 3.0 版本.
    现在终于是出来了 windows 上可用的原生内存缓存了, 希望微软能一直更新迭代下去.
    kneo
        7
    kneo  
       37 天前 via Android
    不服的可以比比。协议好像是兼容 redis 的。
    me1onsoda
        8
    me1onsoda  
       37 天前
    我印象里 Windows 是不支持 epoll 的,nio 这块应该是不会比 linux 上 redis 更强吧
    gav1nwwk
        9
    gav1nwwk  
       37 天前   ❤️ 25
    @bthulu 微软 和 一直更下去 貌似很冲突
    Mithril
        10
    Mithril  
       37 天前
    @me1onsoda Windows 的是 IOCP ,理论上来说无论是设计还是性能都比 Linux 的 epoll 更好一些。
    实际应用上差不了多少。
    stoneabc
        11
    stoneabc  
       37 天前   ❤️ 4
    @me1onsoda Windows 可是有"纯血"的异步 IO IOCP 啊……
    huang119412
        12
    huang119412  
       37 天前
    看 benchmark ,和其他测试选手比,Redis 基本上是最弱的,这也可以想到。毕竟 Redis 执行引擎是阻塞单线程,Redis 多线程只是 io 线程,测试的又是单机。Redis 单机性能本来就没啥优势,一般一台服务器上也不会只部署一个 Redis 进程。
    shuax
        13
    shuax  
       37 天前   ❤️ 2
    @me1onsoda epoll 天下无敌?
    bthulu
        14
    bthulu  
       37 天前
    @me1onsoda windows 上的 IOCP 比 epoll 强的多, 只是因为 Linux 上没有对标的东西, 大家都不带 windows 玩罢了.
    Rache1
        15
    Rache1  
       37 天前
    @bthulu #6 Windows 上也有 Redis 5.x

    Releases · tporadowski/redis
    https://github.com/tporadowski/redis/releases
    junmoxiao
        16
    junmoxiao  
       37 天前
    @bthulu io_uring
    Mrun
        17
    Mrun  
       37 天前
    @me1onsoda #8
    epoll 这种伪异步,Win 上的 IOCP 是完善的异步
    superrichman
        18
    superrichman  
       37 天前   ❤️ 5
    各个竞品都号称超越 redis ,但是最后大家还是用 redis
    crysislinux
        19
    crysislinux  
       37 天前
    这么巧。是因为预料到了 Redis 要改 license 么,哈哈。
    lusi1990
        20
    lusi1990  
       37 天前 via Android
    又是吊打苹果的一天
    easonwood91
        21
    easonwood91  
       37 天前   ❤️ 1
    我还以为吹加内特呢
    luzemin
        23
    luzemin  
       37 天前
    侧面告诉哪些语言大战的人,高级语言放在大佬手里一样能整出与 C 性能相当的东西。
    huangzongzhuan
        24
    huangzongzhuan  
       37 天前
    @easonwood91 你小子
    Huelse
        25
    Huelse  
       37 天前
    https://github.com/dragonflydb/dragonfly 了解下,无缝对接 redis
    matrix1010
        26
    matrix1010  
       37 天前   ❤️ 1
    看 Garnet 的 benchmark( https://microsoft.github.io/garnet/docs/benchmarking/results-resp-bench)的 Figure 1 ,只有 Garnet 在单 session 无并发的情况下比 Redis 性能更强。注意 y 轴是对数,dragonfly 在这种情况下的性能相当差
    conglovely
        28
    conglovely  
       37 天前
    @bthulu #6 我本地装了一个
    LeeReamond
        29
    LeeReamond  
       37 天前
    你这贴,C#有啥好震惊的, 一看就没做过涉及到 socket 编程的项目,起码没做过性能分析。网络 IO 编程里即使主观上不进行任何等待,你的代码有 99%的时间都在睡眠等待 IO 。。。
    mightybruce
        30
    mightybruce  
       37 天前
    现在吹比 redis 性能好的缓存多了去了,但是哪有一个有 redis 流行, 难道你才知道。
    Rust 和 Go 语言轮番实现 redis 的 项目还少吗
    这种还是 C# 和 windows 的就不用看了吧,难道你们公司都用的是 windows server
    Dorian101
        31
    Dorian101  
       37 天前
    The Garnet server is written in modern .NET C#, and runs efficiently on almost any platform. It works equally well on Windows and Linux, and is designed to not incur garbage collection overheads. You can also extend Garnet's capabilities using new .NET data structures to go beyond the core API.
    luzemin
        32
    luzemin  
       37 天前   ❤️ 4
    @mightybruce
    >这种还是 C# 和 windows 的就不用看了吧,难道你们公司都用的是 windows server

    纠正一下:
    虽然 Windows+.NET Framework 绑定是人们固有印象,但是还是要纠正一下,.NET 2016 年后就跨平台了


    当然这不是使不使用的唯一考虑条件
    lichao
        33
    lichao  
       37 天前
    @mightybruce C# 和 Windows 早就不是强绑定了,Linux 上也可以用
    kaiserzhang123
        34
    kaiserzhang123  
       37 天前
    碾压算不上吧,只是与 Redis 有了竞争,选择多了一个,过去一段时间,内存型的数据库能用在生产上的感觉也只有 Redis 。
    skinny
        35
    skinny  
       37 天前
    Redis 开源协议更改针对的云服务提供商,像一般用户的项目即便部署在云上也没有影响。微软也是云服务提供商,如果它不想交钱开发替代品也是正常,不过鬼知道这是不是又一个烂尾项目,非云服务提供商用户没必要去帮忙踩坑当小白鼠。
    BeiChuanAlex
        36
    BeiChuanAlex  
       37 天前
    从语言上来说,还有比 C 写数据库 "更快的" 吗?
    sloknyyz
        37
    sloknyyz  
       37 天前
    微软真是越来越有国内公司那味了,不知道是不是一个 kpi 项目
    matrix1010
        38
    matrix1010  
       37 天前 via iPhone   ❤️ 5
    @sloknyyz 人家文档测试 benchmark 一应俱全。这类东西还真就应该大公司开源,个人开发者没有真实高并发场景,一般也不会用 72c140g 的机器跑测试
    thinkershare
        39
    thinkershare  
       37 天前
    看好这个项目,我们公司就大量使用 Windows Server 作为服务器,Redis 在 Windows 下就是狗屎。
    nothingistrue
        40
    nothingistrue  
       37 天前
    好是大概率好,但不一定能铺开,要是微软商务不介入,这东西最终会像 MicroSoft JDK 那样成为 Azure 的挂件,甚至可能更惨的像 Window 11 andorid 子系统那样被抛弃。
    vgbw
        41
    vgbw  
       37 天前
    官网的 Developer Guide 写的很详细
    idealhs
        42
    idealhs  
       37 天前   ❤️ 1
    @gav1nwwk 你猜 C#一直更下去多少年了?
    idealhs
        43
    idealhs  
       37 天前
    就像 Docker 会被取代一样,Redis 以后只会成为一种范式,大家都是 Redis 兼容,都比 Redis 强,都不用 Redis
    guo4224
        44
    guo4224  
       37 天前
    @conglovely 我的是# Server
    garnet_version:1.0.0
    garnet_mode:standalone
    os:Unix 14.4.0
    processor_count:8
    arch_bits:64
    uptime_in_seconds:3492.038925
    uptime_in_days:0.0404171171875
    monitor_task:disabled
    monitor_freq:0
    latency_monitor:disabled
    run_id:3a304c5eef6a3db74274bf9ac463af486237358e
    yefuchao
        45
    yefuchao  
       37 天前   ❤️ 1
    Under the new license, cloud service providers hosting Redis offerings will no longer be permitted to use the source code of Redis free of charge. For example, cloud service providers will be able to deliver Redis 7.4 only after agreeing to licensing terms with Redis, the maintainers of the Redis code. These agreements will underpin support for existing integrated solutions and provide full access to forthcoming Redis innovations.

    https://redis.com/blog/redis-adopts-dual-source-available-licensing/
    xierqii
        46
    xierqii  
       37 天前
    国内很难有它的市场
    gav1nwwk
        47
    gav1nwwk  
       37 天前   ❤️ 1
    @idealhs 微软能坚持下来的通常是新兴的市场,和现有标准竞争他是一次没赢过,WP 凉了,哪怕是 Win8 的设计也凉了,WSA 也凉了,微软做东西给人一种脑子一热就发布,发布后也不怎么维护,本着能用就行的底线做产品
    idealhs
        48
    idealhs  
       37 天前   ❤️ 3
    @gav1nwwk #47
    不明白你怎么有信心凭借几个枚举就能够评价一个巨型公司的行事。
    如果我举例 Windows, Office, Visual Studio, Bing, Xbox, SQL Server, Azure, OneDrive, Teams, LinkedIn, PowerBI, Dynamics 365, Skype 来说明微软是一个善于坚持,并且坚持的足够比大部分公司都持久的公司,且其中不乏与现有标准竞争的产品,阁下又该如何应对?
    GrayXu
        49
    GrayXu  
       36 天前
    虽然但是,redis 也不快,比 redis 快的都好几轮了
    poorcai
        50
    poorcai  
       36 天前
    感觉想把 redis 比下去,压根就不是使用 `快不快`了,而是生态完全比不了
    encro
        51
    encro  
       36 天前
    @idealhs

    vscode, typescript 你得算上。。。
    zed1018
        52
    zed1018  
       36 天前
    一般来讲项目方的 benchmark 可以只用看看就好来形容
    securityCoding
        53
    securityCoding  
       36 天前
    我用云 redis 。。。它有吗
    yicong135
        54
    yicong135  
       36 天前
    如果汇编会不会更快
    kneo
        55
    kneo  
       36 天前 via Android
    @Dorian101 “但是哪有一个有 redis 流行”
    别人谈技术谈性能的时候,你在谈时尚。
    lixintcwdsg
        56
    lixintcwdsg  
       36 天前
    这东西就是内存存取,尽量压榨单核 CPU 和 IO 尽量用满
    谈什么碾压不碾压的。。。
    hez2010
        57
    hez2010  
       36 天前
    @sloknyyz 这玩意是微软研究院 2021 年开始做,最近终于搞出来的玩意。
    另外 Azure 已经内部把 Redis 换成这个 Garnet 上生产上了几个月了。
    livepps
        58
    livepps  
       36 天前 via Android
    空数据库,默认配置 save 一下耗时 5 秒,保存了一个 8g 大小的文件。
    KAMx
        59
    KAMx  
       36 天前
    @hez2010 就这命令兼容的完备度上生产?
    HaroldFinchNYC
        60
    HaroldFinchNYC  
       36 天前
    @gav1nwwk #9 你肯定搞错了,google 和阿里才是经常弃坑的
    hez2010
        61
    hez2010  
       36 天前
    @KAMx 他们做的时候就是挑着自己需要用的命令优先做的,满足了需求就上生产了。
    其实就算是用 redis 也不见得所有命令都会用得到。
    agagega
        62
    agagega  
       36 天前
    都是做技术的,说话别整营销号那一套,比如什么碾压、吊打,还有唯语言论,最经典的比如用 Rust 写的就一定牛逼
    gav1nwwk
        63
    gav1nwwk  
       36 天前
    @hez2010 这么说 Azure 团队还是有可能长期维护的
    codegenerator
        64
    codegenerator  
       36 天前
    @me1onsoda win 上有 iocp ,io 上应该不输,主要还是看 gc 这部分
    dif
        65
    dif  
       36 天前
    多一个竞品挺好,面试题又多了几道。
    billzhuang
        66
    billzhuang  
       36 天前
    公司使用 windows server ,但还是可以搞几台 linux 装 redis 的吧
    cnleon
        67
    cnleon  
       36 天前
    它的 benchmark 是 72 vcpus, 144 GiB memory 。 这个比试不大公平啊
    mayli
        68
    mayli  
       36 天前
    @Trim21 并没有
    KiraMaple
        69
    KiraMaple  
       31 天前
    @luzemin #23 只要把语言当成工具就可以了。就像 garnet 内存管理直接使用 unsafe 指针管理内存大大降低 GC 带来的影响,写 NodeJS 也可以用 napi 把 CPU 密集型的运算用 C++代码或库负责,现在很多 CPU 密集型运算的库最终就是调用的 C++代码。
    hez2010
        70
    hez2010  
       31 天前
    简单在我自己的电脑上跑了一下 memtier_benchmark:
    memtier_benchmark -t 4 -c 50 --pipeline=1024 -n 1000000

    Redis:

    ALL STATS
    ============================================================================================================================
    Type Ops/sec Hits/sec Misses/sec Avg. Latency p50 Latency p99 Latency p99.9 Latency KB/sec
    ----------------------------------------------------------------------------------------------------------------------------
    Sets 408346.45 --- --- 46.40698 42.23900 66.04700 70.14300 31458.55
    Gets 4083419.55 18668.12 4064751.43 46.35596 42.23900 66.04700 70.14300 159685.06
    Waits 0.00 --- --- --- --- --- --- ---
    Totals 4491766.00 18668.12 4064751.43 46.36059 42.23900 66.04700 70.14300 191143.62

    Garnet:

    ALL STATS
    ============================================================================================================================
    Type Ops/sec Hits/sec Misses/sec Avg. Latency p50 Latency p99 Latency p99.9 Latency KB/sec
    ----------------------------------------------------------------------------------------------------------------------------
    Sets 1009126.20 --- --- 18.53643 17.79100 29.69500 35.58300 77741.95
    Gets 10091151.04 91566.19 9999584.85 18.51609 17.79100 29.69500 35.58300 396130.24
    Waits 0.00 --- --- --- --- --- --- ---
    Totals 11100277.24 91566.19 9999584.85 18.51794 17.79100 29.69500 35.58300 473872.19

    确实 Garnet 无论是吞吐量还是延时都碾压了 Redis 。

    哪怕设置 --pipeline=1 让 benchmark 跑完一个请求之后再发下一个请求的这种利好 redis 的单线程测试场景,garnet 一样跑出了比 redis 更好的成绩。
    viitgenstand
        71
    viitgenstand  
       29 天前
    garnet 可以直接使用现有的 redis 客户端管理工具连接,使用起来应该还是挺方便的,就看性能和稳定性了
    sky96111
        72
    sky96111  
       28 天前
    @idealhs #39 你猜有几个 C#(
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2803 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 06:39 · PVG 14:39 · LAX 23:39 · JFK 02:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.