Java 从google app engine到外部服务的并发连接数量是否有限制?
我们有一个基于java7的google应用程序引擎应用程序。对于某些报告生成过程,我们已经在AWS中使用了外部服务。此外部服务基于spring,部署在tomcat7实例上 我们正在从gae应用程序中使用此外部服务的REST API,并从中获得输出。最近,我们需要使用URLFetch并行化此报告生成任务 我同时启动12个POST请求,然后尝试使用URLFetch收集结果。(我对所有请求使用相同的外部服务url) 但是tomcat同时只收到2个请求,这给我们造成了瓶颈 什么可能会限制tomcat,使其只能同时处理2个请求?Java 从google app engine到外部服务的并发连接数量是否有限制?,java,spring,google-app-engine,tomcat,Java,Spring,Google App Engine,Tomcat,我们有一个基于java7的google应用程序引擎应用程序。对于某些报告生成过程,我们已经在AWS中使用了外部服务。此外部服务基于spring,部署在tomcat7实例上 我们正在从gae应用程序中使用此外部服务的REST API,并从中获得输出。最近,我们需要使用URLFetch并行化此报告生成任务 我同时启动12个POST请求,然后尝试使用URLFetch收集结果。(我对所有请求使用相同的外部服务url) 但是tomcat同时只收到2个请求,这给我们造成了瓶颈 什么可能会限制tomcat,使
- 外部服务上的spring上是否有任何配置李>
- tomcat上有什么需要配置的吗
- 谷歌应用程序引擎上有什么需要配置的吗
URLFetchService fetcher = URLFetchServiceFactory.getURLFetchService();
FetchOptions fetchOptions = FetchOptions.Builder.withDefaults();
fetchOptions.doNotValidateCertificate();
fetchOptions.setDeadline(60d);
/* Initiate requests */
ArrayList<Future<HTTPResponse>> asyncResponses = new ArrayList<Future<HTTPResponse>>();
for(int i=startPage;i<(endPage+1);i++){
/* Create list of parameters to pass wkhtmltoPDF */
Map<String, Object> map = new HashMap<String, Object>();
map.put("parameters", parameters);
targetUrl = referer + "?viewMode=export&subjectId="+ subjectId +"&page=" + i;
map.put("targetUrl", targetUrl);
Gson gson = new Gson();
String data = gson.toJson(map);
URL serviceUrl = new URL(EXS_SERVER_URL+"/wkhtmltopdf");
HTTPRequest request = new HTTPRequest(serviceUrl, HTTPMethod.POST, fetchOptions);
HTTPHeader header = new HTTPHeader("Content-Type", "application/json; charset=UTF-8");
request.setHeader(header);
request.setPayload(data.getBytes("UTF-8"));
Future<HTTPResponse> responseFuture = fetcher.fetchAsync(request);
asyncResponses.add(responseFuture);
}
/* collect responses */
ArrayList<Integer> responseCodes = new ArrayList<Integer>();
for(int i=0;i<asyncResponses.size();i++){
Future<HTTPResponse> serviceResponse = null;
try {
serviceResponse = asyncResponses.get(i);
int responseCode = serviceResponse.get(59, TimeUnit.SECONDS).getResponseCode();
responseCodes.add(responseCode);
byte[] pdfBuffer = serviceResponse.get(59, TimeUnit.SECONDS).getContent();
if (pdfBuffer != null){
PdfReader page = new PdfReader(pdfBuffer);
copy.addDocument(page);
}
} catch (Exception e) {
e.printStackTrace();
}
}
URLFetchService fetcher=URLFetchServiceFactory.getURLFetchService();
FetchOptions FetchOptions=FetchOptions.Builder.withDefaults();
fetchOptions.doNotValidateCertificate();
获取选项。设置截止日期(60d);
/*发起请求*/
ArrayList asyncResponses=新建ArrayList();
对于(int i=起始页;i