扩展Web应用程序

我开发了一个发送短信的API目前有三个MySql表在同一台服务器上运行(sms_account ,sms_number和sms_transaction)。</ p>

我想使用haproxy进行负载平衡并提高性能,以便在多个Web服务器之间拆分请求,但我真的不知道如何处理数据库部分 它的。 我知道我可以在master-master场景中创建一个单独的数据库集群,但是想知道它是否可以做得更好。</ p>

我想过有一个包含相同数据库的主集群数据库 网络服务器。 sms_account和sms_number表只能在这个表上更新,而且这个表可以更新Web服务器sms_account和sms_number表,因为这些表不会经常更改。 然后我认为每个web服务器/ mysql实例都可以使用每个sms_transaction表中的记录定期更新master数据库。</ p>

这听起来有点乱,但是这样想数据库加载会 真的很低,因为所有的Web服务器数据库都会保持小而快,而主要的数据库可以用于计费。</ p>

我只想对设计提出第二意见。 我认为这种方式在故障情况下,任何Web服务器都可以继续独立于其他服务器工作。</ p>

Web服务器实际上是记录事务,就是这样。 没有复杂的查询。 我可以从主数据库进行报告等。</ p>

非常感谢</ p>
</ div>

展开原文

原文

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

duangai1916
duangai1916 可能不是,我还会使用多个Web节点和单个数据库服务器来提高性能吗?虽然我将来需要一个计划会很好。
大约 4 年之前 回复
dpjjmo3079
dpjjmo3079 嗨罗斯,你确定你也需要扩展MySQL吗?
大约 4 年之前 回复

1个回答



“定期更新”位的问题始终是一致性。</ p>

进行自己的合并 算法是可能的,但是你最终会得到一个错误处理混乱。</ p>

我真的建议你等到你需要时缩放MySQL。 保持您的数据访问代码相当隔离,并且您可以随时/何时需要进行重构。</ p>

一旦确实需要重构,您就可以进行完美的主/从属配置。 。</ p>
</ div>

展开原文

原文

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..

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问