使用Apache Tomcat模拟网络延迟? [英] Simulate network latency with Apache Tomcat?

查看:411
本文介绍了使用Apache Tomcat模拟网络延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以配置Apache Tomcat来模拟客户端在通过localhost从服务器请求数据时通常会遇到的网络延迟?我正在尝试测试Java Servlet应用程序的前端如何响应响应时间较慢的请求。

Is it possible to configure Apache Tomcat to simulate network latency that a client would normally have when requesting data from server for requests over localhost? I'm trying to test how the front end of a Java Servlet application will respond to requests that have slow response times.

我知道我可以进入并将 Thread.sleep(100)添加到我的所有Servlet Java源文件中,但我宁愿有一个可以在Tomcat而不是在我的实际应用程序中配置的解决方案。

I know I could go in and add Thread.sleep(100) to all of my Servlet Java source files, but I'd rather have a solution that can be configured in Tomcat rather than in my actual application.

推荐答案

你可以模拟通过在localhost上使用代理来引入网络延迟,这会导致延迟,带宽限制,甚至丢包。

You can simulate network latency by using a proxy on your localhost which introduces latency, bandwidth restrictions, and even drop packets.

DonsProxy将完成这项工作。 这是一篇描述如何配置的好文章它模拟一个糟糕的网络上的用户。

DonsProxy will do the job. Here's a good article describing how to configure it to simulate a user on a poor network.

这篇关于使用Apache Tomcat模拟网络延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆