减少通知系统上的数据库写操作或更改适当的数据库? [英] Reduce database write on notification system or change approbate database?
问题描述
我们有一个Web应用程序,它需要向用户发送大量通知(每天超过 1,000,000
条通知).我们对数据库使用
PS ::我需要将每个通知保存到数据库,并需要显示给用户.无法跳过这一部分.
缩小数据集.
- 对UUID使用ascii.您真的需要UUID吗?
- 将UUID压缩为
BINARY(16)
.(这不能完全解决UUID导致的可伸缩性噩梦,但会有所帮助.) - 使用ENUM作为类型和状态,而不是长VARCHAR.
- 两种类型"之间有什么区别?
- 您需要8字节的BIGINT吗?
- 有3个时间戳,您需要多个吗?
我看不到 user_id
??
We have a web app which requires to send lots of notifications to users (over 1,000,000
notifications per day). We use Laravel and MySQL for the database.
I loop through a group of users send notifications and save it to the database. Let's say if I want to send a group of 1000
users. The data will be written to the DB 1000
time. As I said, we have over 1,000,000
notifications per day, which take so many resources.
What's the appropriate way to approach this problem?
I should change to a new database system like MongoDB or I should redesign the notification table schema and the way I save to DB?
The following is my notification table schema.
PS:: I need to save every notification to DB and need to show to users. Can't skip this part.
Shrink the dataset.
- Use ascii for UUIDs. Do you really need a UUID?
- Compress UUIDs into
BINARY(16)
. (This won't completely solve the scalability nightmare that UUIDs lead to, but it will help some.) - Use ENUM for types and status, not long VARCHARs.
- What is the difference between the two "types"?
- Do you need 8-byte BIGINT?
- There are 3 TIMESTAMPs, do you need more than one?
I don't see anything like user_id
??
这篇关于减少通知系统上的数据库写操作或更改适当的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!