geekyijun / seckill Goto Github PK
View Code? Open in Web Editor NEWseckill for imocc
seckill for imocc
在慕课网听了你的这门课程,真是太喜欢了。老师你是我在慕课网听过的课程里讲课讲得最好的老师。所以我用谷歌搜索了你在慕课网的头像就找到这里啦,哈哈。
希望你能回来慕课网开一门实战课程,不管什么课,多少钱,我都去支持!很多慕课网的小伙伴也都希望你继续开课啊,不管是免费的还是收费。
这么好的老师不能放过啊!
希望能多听多学老师的经验!哈哈!!!
自己访问什么都没有问题,但用jmeter一压测,就出问题了
2018-05-21 20:10:07.052 ERROR 10132 --- [io-8080-exec-18] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out] with root cause java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_131] at java.net.SocketInputStream.socketRead(Unknown Source) ~[na:1.8.0_131] at java.net.SocketInputStream.read(Unknown Source) ~[na:1.8.0_131] at java.net.SocketInputStream.read(Unknown Source) ~[na:1.8.0_131] at java.net.SocketInputStream.read(Unknown Source) ~[na:1.8.0_131] at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:196) ~[jedis-2.9.0.jar:na] at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Protocol.process(Protocol.java:151) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Protocol.read(Protocol.java:215) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:259) ~[jedis-2.9.0.jar:na] at redis.clients.jedis.BinaryJedis.get(BinaryJedis.java:244) ~[jedis-2.9.0.jar:na] at com.redis.RedisUtils.getSeckill(RedisUtils.java:41) ~[classes/:na]
public Seckill getSeckill(String id) { System.out.println("id = " + id); String key = "seckill:" + id; byte[] bytes = jedis.get(key.getBytes()); System.out.println("bytes = " + bytes); //if (bytes == null) return null; Seckill seckill = schema.newMessage(); ProtostuffIOUtil.mergeFrom(bytes, seckill, schema); return seckill; }
大概出现在 byte[] bytes = jedis.get(key.getBytes()); 这一句,具体原因我还是差不清楚,望老师可以解答一下。
``create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'
对于MySQL version:8.0.19,要设置create_time自动更新,因为insertSuccessKilled()没有插入create_time,create_time为默认值00-00-00 00:00:00。不然在测试queryByIdWithSeckill()时程序会报错:Caused by: com.mysql.cj.exceptions.DataReadException: Zero date value prohibited。
按照老师的代码写的存储过程,在执行CALL execute_seckill(1007,13813813822,NOW(),@r_result);
报错ERROR 1146 (42S02): Table 'seckill.success_kill' doesn't exist
请问老师知道是怎么一回事吗
public Exposer exportSeckillUrl(long seckillId) {
// 优化点:缓存优化:超时的基础上维护一致性
//1:访问redis
Seckill seckill = redisDao.getSeckill(seckillId);
if (seckill == null) {
//2:访问数据库
seckill = seckillDao.queryById(seckillId);
if (seckill == null) {
return new Exposer(false, seckillId);
} else {
//3:放入redis
redisDao.putSeckill(seckill);
}
}
这里在并发的时候,是不是会出现多次查询数据库,多次更新redis?
谢谢~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.