自己访问什么都没有问题,但用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()); 这一句,具体原因我还是差不清楚,望老师可以解答一下。