之前学习了netty和http异步连接池,跟仓颉大神问的结果是netty的http客户端性能比apache的好。
咱今儿就用三种http连接池进行测试。
首先是pom.xml:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 5 <groupId>com.company</groupId> 6 <artifactId>websocket_demo</artifactId> 7 <version>0.0.1-SNAPSHOT</version> 8 <packaging>jar</packaging> 9 10 <name>websocket_demo</name> 11 <url>http://maven.apache.org</url> 12 13 <properties> 14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 15 <junit.version>4.12</junit.version> 16 <log4j.version>1.2.17</log4j.version> 17 <netty.version>4.1.36.Final</netty.version> 18 <google.gson.version>2.3</google.gson.version> 19 <guava.version>19.0</guava.version> 20 </properties> 21 22 <dependencies> 23 <!-- junit --> 24 <dependency> 25 <groupId>junit</groupId> 26 <artifactId>junit</artifactId> 27 <version>${junit.version}</version> 28 <scope>test</scope> 29 </dependency> 30 31 <!-- log4j --> 32 <dependency> 33 <groupId>log4j</groupId> 34 <artifactId>log4j</artifactId> 35 <version>${log4j.version}</version> 36 </dependency> 37 38 <!-- netty --> 39 <dependency> 40 <groupId>io.netty</groupId> 41 <artifactId>netty-all</artifactId> 42 <version>${netty.version}</version> 43 </dependency> 44 45 <!-- gson --> 46 <dependency> 47 <groupId>com.google.code.gson</groupId> 48 <artifactId>gson</artifactId> 49 <version>${google.gson.version}</version> 50 </dependency> 51 52 <!-- guava --> 53 <dependency> 54 <groupId>com.google.guava</groupId> 55 <artifactId>guava</artifactId> 56 <version>${guava.version}</version>