Update Rocket.md

pull/9/head
hmao 5 years ago committed by GitHub
parent a705c2a187
commit d0671c8052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1005,6 +1005,9 @@ select的几大缺点
  对于第三个缺点epoll没有这个限制它所支持的FD上限是最大可以打开文件的数目这个数字一般远大于2048,举个例子,在1GB内存的机器上大约是10万左右具体数目可以cat /proc/sys/fs/file-max察看,一般来说这个数目和系统内存关系很大。   对于第三个缺点epoll没有这个限制它所支持的FD上限是最大可以打开文件的数目这个数字一般远大于2048,举个例子,在1GB内存的机器上大约是10万左右具体数目可以cat /proc/sys/fs/file-max察看,一般来说这个数目和系统内存关系很大。
### 乐观锁和悲观锁
### 秒杀并发情况下库存为负数问题 ### 秒杀并发情况下库存为负数问题
1. for update显示加锁 1. for update显示加锁
@ -1018,3 +1021,5 @@ select quantity from products WHERE id=3 for update;
quantity = select quantity from products WHERE id=3; quantity = select quantity from products WHERE id=3;
update products set quantity = ($quantity-1) WHERE id=3 and queantity = $quantity; update products set quantity = ($quantity-1) WHERE id=3 and queantity = $quantity;
#

Loading…
Cancel
Save