Comments (7)
from seckill.
` public String execute() {
long num = redis.opsForValue().increment(key, -1);
if (num <= 0) {
return "秒杀失败";
} else {
//入队
mq.send(new HappyLock(key, Integer.parseInt(num + "")));
}
return "";
}`
如上代码
假设有10w个请求,但商品数量只有100件(或者更多)。我redis预减少,屏蔽掉了9.9k个无效请求(if else那里判断了一下),难道mysql还处理不了这100个请求么?
from seckill.
from seckill.
@lukeewu
hahah,小米那个另当别论哈
你只是100个,假如是0.00001秒来了一百个,那么。。。
我想问下这个什么意思呢?我测试了好多遍,上面那段代码并不会出现超卖现象
from seckill.
from seckill.
mysql依然要在0.000001秒内接收到100次请求
哈哈哈,这个还是很有难度的。
我用的是jmeter测试的,一秒模拟了1w了线程,没有出现问题。
还有待讨论,感谢你的回答
from seckill.
from seckill.
Related Issues (4)
- 5.客户端轮询好像没实现? HOT 2
- 测试地址无法访问
- emm
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seckill.