Rest 如何通过配置tomcat生成503错误?

Rest 如何通过配置tomcat生成503错误?,rest,tomcat,configuration,tomcat8,Rest,Tomcat,Configuration,Tomcat8,我想通过设置maxThreads、maxConnections、acceptCount等配置属性来配置我的Apache Tomcat/8.5.37。这样,我可以通过发送一些并发请求(比如一次发送100个请求)在回复REST调用时得到503个错误。 我该怎么做 编辑:在某些情况下,我会收到“连接被拒绝”的响应。如何获取状态503而不是“连接被拒绝”?在server.xml文件中添加以下部分 <Connector port="8080" protocol="HTTP/1.1"

我想通过设置maxThreads、maxConnections、acceptCount等配置属性来配置我的Apache Tomcat/8.5.37。这样,我可以通过发送一些并发请求(比如一次发送100个请求)在回复REST调用时得到503个错误。 我该怎么做


编辑:在某些情况下,我会收到“连接被拒绝”的响应。如何获取状态503而不是“连接被拒绝”?

server.xml
文件中添加以下部分

<Connector port="8080" protocol="HTTP/1.1"
           maxThreads="10"
           maxConnections="10"
           connectionTimeout="20000"
           redirectPort="8443"
           maxPostSize="209715200" />


了解更多信息。回答也可能有助于尝试此配置。然后同时发出50个请求。但是所有的请求都是以5个批处理的。您可以通过在jsp/servlet页面中添加java代码
Thread.sleep(10或15分钟)
进行模拟,以便请求持续运行。