iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
Livid
408.15D
544.94D
V2EX  ›  iDev

这里有人实现过大规模的 APNS 系统么?

  •  
  •   Livid ·
    PRO
    · Dec 19, 2011 · 11798 views
    This topic created in 5451 days ago, the information mentioned may be changed or developed.
    目前在一台 1G 内存的日本 Linode 上,使用 Python 基本上可以做到每秒发送 10 条。但是这样的话,一整天也顶多可以发送 80 多万而已。

    后端使用了 celery,因此目前貌似主要瓶颈是在内存。

    这里有人实现过大规模的 APNS 系统么,在你们实现的系统上,每秒并发的发送可以做到多少呢,用的是什么样的语言和硬件呢?
    23 replies  •  2015-12-09 17:50:34 +08:00
    Sai
    Sai
    Dec 19, 2011 via iPad
    1
    我们新的 Push 系统,单线程每秒至少 100 条,一般可以开到五线程。
    Livid
    Livid
    MOD
    OP
    PRO
    Dec 19, 2011
    2
    @Sai 所以,你做的新 push 系统可以在 VPS 上每秒完成 500 条,每分钟 30000 条?
    peterlu
    peterlu
    Dec 19, 2011
    3
    我们现在用parse.com 轮子没有必要自己重复造。
    soulhacker
    soulhacker
    Dec 19, 2011
    4
    最近正在研究 parse.com 呢,似乎算是移动 PaaS 里比较完整的一个东西,不知道 beta 结束会怎么收费……
    gonefish
    gonefish
    Dec 19, 2011
    5
    貌似我们公司现在是单台机器每秒600条
    Livid
    Livid
    MOD
    OP
    PRO
    Dec 19, 2011
    6
    @gonefish @Sai 嗯,似乎找到原因了。

    应该是在一次连接中发送多条,而不是每连接一次发送一条。

    改一下试试。
    Sai
    Sai
    Dec 19, 2011
    7
    @Livid 对,一次连接打开以后可以发上几百条以后再开下一个。

    做一个 long polling,开了以后一直往里面写请求似乎也是可行的。
    freefcw
    freefcw
    Dec 19, 2011
    8
    @soulhacker 不是已经有Pricing了么
    tiantian20007
    tiantian20007
    Dec 20, 2011
    9
    用 https://github.com/samuraisam/pyapns 的飘过。是看到instagram用的这个,应该比较靠谱。到还没有压力测过。
    feilaoda
    feilaoda
    Dec 20, 2011
    10
    pyapns代码量很小。貌似不错。 @tiantian20007 你现在最大压力到多少?
    everbird
    everbird
    Dec 20, 2011
    11
    @livid每连接一次发一条会被当作DDOS攻击的吧...
    "You should also retain connections with APNs across multiple notifications. APNs may consider connections that are rapidly and repeatedly established and torn down as a denial-of-service attack. Upon error, APNs closes the connection on which the error occurred."
    bl0ck
    bl0ck
    Dec 20, 2011
    12
    CMGS
    CMGS
    Dec 20, 2011
    13
    每次发一条连接一次会被判DDOS,豆瓣的做法是做了个APNS的服务,基于Gevent和APNSWrapper,每个应用保持一个长连接到APPLE服务器,挂了自动重连,然后应用走一个接口push message到这个server,这个server负责push到apple server。
    soulhacker
    soulhacker
    Dec 20, 2011
    14
    @freefcw 嗯,那个 pricing 还是比较 OK 的,如果以后不变的话……

    @bl0ck 这个 Urban Airship 还没试过,回头试试……
    imom0
    imom0
    Dec 20, 2011
    15
    就说10条/s慢得太离谱了。
    @CMGS 应该和这个差不多吧,除了长连接。 https://github.com/gwik/applepushnotification
    CMGS
    CMGS
    Dec 20, 2011
    16
    @imom0 恩,差不多。。不长连接APPLE会干了你= =
    maven
    maven
    Dec 26, 2011
    17
    我的Linode VPS 发APNs遇到的问题是socket会自己停止服务
    Livid
    Livid
    MOD
    OP
    PRO
    Dec 26, 2011❤️1
    18
    今天在服务器上用 APNSWrapper + Celery 获得的最高发送性能 933/s。
    orzzzzz
    orzzzzz
    Dec 26, 2011
    19
    嗯,最近刚看了一下ApnsPHP,是不是说应connect之后可以一直send,不disconnect?
    andy
    andy
    Dec 27, 2011
    20
    谁知道Android有什么好的方案吗?
    etxiaohei
    etxiaohei
    Mar 21, 2013
    21
    @Livid 也是需要用长连接发送吧,一次一条还是慢,就算用celery搭建分布式
    zkdfbb
    zkdfbb
    May 16, 2013
    22
    APNSWrapper + Celery 怎么做的?
    为什么我单用APNSWrapper发送非常慢,几乎是一条一秒,在实验环境下
    已经改成长连接了
    happyface
    happyface
    Dec 9, 2015
    23
    今天本来想优化自己的推送服务的,测试测试着,意识到自己跳进了一个坑,就过来搜搜看,果然大家都跳过。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1960 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 61ms · UTC 08:07 · PVG 16:07 · LAX 00:07 · JFK 03:07
    ♥ Do have faith in what you're doing.