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 算法题:数的划分,用记忆化DFS做WA求调
  • ¥15 chatglm-6b应用到django项目中,模型加载失败
  • ¥15 武汉岩海低应变分析软件,导数据库里不显示波形图
  • ¥15 CreateBitmapFromWicBitmap内存释放问题。
  • ¥30 win c++ socket
  • ¥30 CanMv K210开发板实现功能
  • ¥15 C# datagridview 栏位进度
  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile