简体   繁体   English

jar中的HTTP连接速度比Eclipse中慢

[英]Http connections in jar slower than in eclipse

I have a java software that I made on Eclipse and during the execution there is a series of http requests and responses that I have to make. 我有一个在Eclipse上制作的Java软件,在执行过程中,必须执行一系列的HTTP请求和响应。 They run pretty smoothly on Eclipse (using the org.apache.http library) but, when I export to a runnable jar, it's painful to see the time it takes between each http connection. 它们在Eclipse上运行非常平稳(使用org.apache.http库),但是,当我导出到可运行的jar时,很难看到每个HTTP连接之间的时间。 I can almost say that the execution takes roughly 10x longer. 我几乎可以说执行时间大约要长10倍。 I'm on the same JRE and I'm using the same parameters I use to open eclipse ( -Xms40m -Xmx512m). 我在同一JRE上,并且使用与打开Eclipse(-Xms40m -Xmx512m)相同的参数。

JVM console shows that Eclipse spawns 5 threads to handle my program. JVM控制台显示Eclipse产生了5个线程来处理我的程序。 The runnable jar uses 9 daemon and 1 user thread. 可运行的jar使用9个守护程序和1个用户线程。

Can anyone help me figure out the issue here? 谁能帮我在这里解决问题?

Thank you. 谢谢。

Diagnose the network latency. 诊断网络延迟。 Trying pinging the host you are trying to connect from the machine that has eclipse running, and the machine that you are running from the jar. 尝试ping您尝试从运行Eclipse的计算机和您从jar运行的计算机连接的主机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM