drfals1307 2016-06-29 15:44
浏览 44

扩展Web应用程序

I have developed an API that that send out text messages There are currently three MySql tables running on the same server (sms_account, sms_number and sms_transaction).

I want to use haproxy to load balance and improve the performance to split the requests between multiple web servers but I don't really know how to handle the database part of it. I know I could create a separate database cluster in a master-master scenario but wondered if it could be done better.

I have thought about having one main clustered database that contains an identical database to the webservers. The sms_account and sms_number tables could be updated only on this one and this one could update the web servers sms_account and sms_number tables as these do not change very frequently. I then thought that each web server / mysql instance could periodically update the master database with the records from each of the sms_transaction tables.

It sounds a little messy but thought this way the database load would be really low as all the web server databases would all remain small and fast and the main one could be used for billing.

I'd just like a second opinion on the design. I think this way in a fault scenario any of the web servers could continue working independently of the other servers.

The web servers are literally logging the transaction and that is it. There are no complex queries. I could do the reporting etc from the master database.

Many Thanks

  • 写回答

1条回答

  • dongling2038 2016-07-06 17:12
    关注

    The problem with the "Periodically updating" bit is always consistency.

    Making your own merge algorithm is possible, but you will end up with an error handling mess down the road.

    I'd really recommend you wait on scaling MySQL until you need to. Keep your data access code fairly well isolated, and you can always refactor if/when you need to.

    Once you do need to refactor, you are in a perfect master/slaves slaves configuration..

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器