开发者社区> 问答> 正文

redis 能 代替 mysql 吗?

redis 能 代替 mysql 吗?

展开
收起
a123456678 2016-06-28 17:57:44 2775 0
2 条回答
写回答
取消 提交回答
  • 以目前的情况来看代替不了!

    1. redis 持久化数据不能保证数据丢失
    2. redis 事务能力支持太弱
    3. 关系型数据库 vs NoSql. 这是一个很大的话题,总之以目前的现状,很难完全替代mysql这种关系型数据库
    2019-07-17 19:48:35
    赞同 展开评论 打赏
  • YouPorn占据整个互联网每秒流量2%, 100Gb/s, 300K queries/s, 是全球访问量最高的视频色情网站.
    HAProxy->Varnish->Nginx-> PHP-FPM->Symfony2->Doctrine->HAProxy->Redis/MySQL
    采用HAProxy做负载均衡,智能分发和后端健康检查.
    采用Syslog-ng来处理集群环境下的日志,其实就是用来收集页面浏览时的数据,比如视频查看计数器.

    Datastore is the most interesting part. Initially they used MySQL but more than 200 million of pageviews and 300K query per second are too much to be handled using only MySQL. First try was to add ActiveMQ to enqueue writes but a separate Java infrastructure is too expensive to be maintained. Finally they add Redis in front of MySQL and use it as main datastore.

    Now all reads come from Redis. MySQL is used to allow the building new sorted sets as requirements change and it’s highly normalized because it’s not used directly for the site. After the switchover additional Redis nodes were added, not because Redis was overworked, but because the network cards couldn’t keep up with Redis :D

    Lists are stored in a sorted set and MySQL is used as source to rebuild them when needed. Pipelining allows Redis to be faster and Append-only-file (AOF) is an efficient strategy to easily backup data.

    2019-07-17 19:48:35
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像