spring boot tomcat 线程数 修改初始线程数 统计性能 每百次请求耗时
[root@f java]# tail -30 nohup.out
searchES-TimeMillisSpent:448
P->1602@fT->http-nio-8080-exec-3t->池州小型柴油机移动泵哪家好kw->柴油机移动泵kws->柴油机移动泵,柴油机水泵机组,自吸柴油机泵
searchES-TimeMillisSpent:387
P->1602@fT->http-nio-8080-exec-10t->东莞知名6061铝合金价格kw->6061铝合金kws->6061铝合金,铝材制造,灯饰铝材
searchES-TimeMillisSpent:661
P->1602@fT->http-nio-8080-exec-6t->中山知名私人聚会外卖服务为先kw->私人聚会kws->私人聚会,冷餐会服务,烹饪队
searchES-TimeMillisSpent:778
P->1602@fT->http-nio-8080-exec-5t->青岛智能干式过滤器系统kw->干式过滤器kws->干式过滤器,废气处理工程,直接燃烧炉
searchES-TimeMillisSpent:469
P->1602@fT->http-nio-8080-exec-7t->金川开发区知名3-6岁潜能培训哪家好kw->3-6岁潜能培训kws->3-6岁潜能培训,学前教育,宝宝潜能开发
searchES-TimeMillisSpent:667
P->1602@fT->http-nio-8080-exec-9t->四川靠谱的宝宝早教机构老师水平怎么kw->宝宝早教kws->宝宝早教,儿童早教,家庭早教加盟
searchES-TimeMillisSpent:420
P->1602@fT->http-nio-8080-exec-2t->韶关正规扫码共享充电批发kw->扫码共享充电kws->扫码共享充电,宾馆小型售货机,扫码充电线
searchES-TimeMillisSpent:30
P->1602@fT->http-nio-8080-exec-10t->盛芯泰销售优质的ISL31492EIBZ原装货卖kw->ISL31492EIBZkws->ISL31492EIBZ,ISL3159EFBZ,ISL32478EIBZ
searchES-TimeMillisSpent:456
P->1602@fT->http-nio-8080-exec-5t->河源生产环保烘干机厂家kw->环保烘干机kws->环保烘干机,节能烘干机,面条烘干机
searchES-TimeMillisSpent:423
P->1602@fT->http-nio-8080-exec-7t->云南正规冷板选哪家kw->冷板kws->冷板,角铁,钢结构
searchES-TimeMillisSpent:598
P->1602@fT->http-nio-8080-exec-3t->横岗街道散打深圳学武术价格价格kw->深圳学武术价格kws->深圳学武术价格,深圳少儿武术,龙岗武术培训班
searchES-TimeMillisSpent:726
P->1602@fT->http-nio-8080-exec-1t->甘肃放心家用空气能热水器哪家好kw->家用空气能热水器kws->家用空气能热水器,OEM热水器,商用空气能热水器
searchES-TimeMillisSpent:355
P->1602@fT->http-nio-8080-exec-9t->安康知名职员办公桌厂家kw->职员办公桌kws->职员办公桌,传统办公家具,玻璃茶几
searchES-TimeMillisSpent:536
P->1602@fT->http-nio-8080-exec-6t->云南昆明高端快题集训机构哪个好kw->快题集训kws->快题集训,短期手绘培训,考研快题辅导
searchES-TimeMillisSpent:355
P->1602@fT->http-nio-8080-exec-5t->襄樊地中海风格火烧石餐桌多少钱kw->火烧石餐桌kws->火烧石餐桌,中式沙发,火烧石餐桌
[root@f java]#
awk 去重
修改初始线程数
server.tomcat.max-threads=100
server.tomcat.minSpareThreads=50 D:\worksp\springtest\src\main\resources\application.properties
rentT->http-nio-8080-exec-39:t->甘南定做公司互联网推广找哪家:kw->公司互联网推广:kws->公司互联网推广,网站建设,网站设计公司
searchES-TimeMillisSpent:683
16213@f:currentT->http-nio-8080-exec-15:t->惠州生产车牌识别收费系统批发价格:kw->车牌识别收费系统:kws->车牌识别收费系统,门禁停车场系统,移动伸缩门
searchES-TimeMillisSpent:348
16213@f:currentT->http-nio-8080-exec-3:t->雁塔区个体外贸公司注册资料:kw->外贸公司注册:kws->外贸公司注册,工商年审,淘丁
searchES-TimeMillisSpent:260
16213@f:currentT->http-nio-8080-exec-41:t->浙江省供应水晶蜜蜡有哪些:kw->水晶蜜蜡:kws->水晶蜜蜡,绿松石桶珠,南红
searchES-TimeMillisSpent:856
16213@f:currentT->http-nio-8080-exec-5:t->滨州知名环保设备工程就业怎么选:kw->环保设备工程就业:kws->环保设备工程就业,环保设备工程专业介绍,光氧催化废气原理图
searchES-TimeMillisSpent:294
16213@f:currentT->http-nio-8080-exec-17:t->东莞有创意的年会场地布置报价:kw->年会场地布置:kws->年会场地布置,年会小品,年会场地选择
searchES-TimeMillisSpent:592
16213@f:currentT->http-nio-8080-exec-16:t->内蒙古自治区资深景观投影灯定制:kw->景观投影灯:kws->景观投影灯,logo灯,定制logo灯
searchES-TimeMillisSpent:693
16213@f:currentT->http-nio-8080-exec-31:t->大同设计广告用板报价:kw->广告用板:kws->广告用板,铺车底塑料板,煤仓衬板
searchES-TimeMillisSpent:595
16213@f:currentT->http-nio-8080-exec-9:t->肇庆投资光伏农业有哪些:kw->光伏农业:kws->光伏农业,光伏板,光伏行业
searchES-TimeMillisSpent:282
16213@f:currentT->http-nio-8080-exec-14:t->内蒙古正规自卸车淋水器配件哪家好:kw->自卸车淋水器配件:kws->自卸车淋水器配件,货车淋水器,自卸车淋水器封头
Apache Tomcat 7 Configuration Reference (7.0.92) - The HTTP Connectorhttps://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Standard_Implementation
minSpareThreads |
The minimum number of threads always kept running. This includes both active and idle threads. If not specified, the default of |
@RequestMapping(value = "/getESversion553ByPost", method = RequestMethod.POST)
public ResponseEntity getES653(@RequestBody TitleKeyword titleKeyword) throws IOException {
long startMethod = System.currentTimeMillis();
long searchESTimeMillisSpent = 0;
String title = titleKeyword.getTitle();
String keyword = titleKeyword.getKeyword();
String keywords = titleKeyword.getKeywords();
String searchESstr;
String resJsonStr;
JSONObject jsonObject;
HttpStatus httpStatus = HttpStatus.OK;
String kwsSeparatorStr = ","; // TODO searchESstr公共部分摘除
// 假设优先级 主关键词>关键词列表>标题,有关键词存在情况下,不考虑标题
if (keyword != null && keyword.replace(" ", "").length() > 0) {
if (keywords != null && keywords.replace(" ", "").length() > 0) {
if (keywords.contains(kwsSeparatorStr)) {
String[] requestKeywordList = keywords.split(kwsSeparatorStr);
// TODO 此处需要结合es数据结构请求的数据结构进行算法优化,使得es搜索结果精准
keywords = keyword + "," + requestKeywordList[0] + "," + requestKeywordList[requestKeywordList.length - 1];
} else {
keywords = keyword + "," + keywords;
}
} else {
keywords = keyword;
}
searchESstr = "{\"from\":0,\"size\":200,\"query\":{\"bool\":{\"should\":[{\"match\":{\"keyword\":{\"query\":\"" + keyword + "\",\"boost\":2}}},{\"match\":{\"text\":{\"query\":\"" + keywords + "\",\"boost\":1}}}]}},\"track_scores\":\"true\",\"sort\":[{\"weight\":{\"order\":\"desc\"}},{\"_score\":{\"order\":\"desc\"}}]}";
} else if (title != null && title.replace(" ", "").length() > 0) {
searchESstr = "{\"from\":0,\"size\":200,\"query\":{\"bool\":{\"should\":{\"match\":{\"text\":{\"query\":\"" + title + "\"}}}}},\"track_scores\":\"true\",\"sort\":[{\"weight\":{\"order\":\"desc\"}},{\"_score\":{\"order\":\"desc\"}}]}";
} else {
// TODO 同上
searchESstr = "";
} if (searchESstr == "") {
resJsonStr = "{\"msg\":\"请求参数非法!BAD_REQUEST!\"}";
} else {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
long timeMillisSpent = 0;
long startEsSearch = System.currentTimeMillis();
long endEsSearch;
// TODO 硬代码
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials("elastic", "admi"));
RestClient restClient = RestClient.builder(new HttpHost("es-cn-m3ats.elasticsearch.aliyuncs.com", 9200))
.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
}).build();
try {
HttpEntity httpEntity = new StringEntity(searchESstr, ContentType.APPLICATION_JSON);
//search a document
String endpoint = "/search_text/_search?";
Response response = restClient.performRequest("GET", endpoint,
Collections.singletonMap("pretty", "false"), httpEntity);
endEsSearch = System.currentTimeMillis();
searchESTimeMillisSpent = endEsSearch - startEsSearch;
resJsonStr = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
resJsonStr = "{\"msg\":\"" + e.toString() + "\"}";
httpStatus = HttpStatus.REQUEST_TIMEOUT;
} finally {
credentialsProvider.clear();
restClient.close();
}
}
Thread t = Thread.currentThread();
String debug = ManagementFactory.getRuntimeMXBean().getName() + ":currentT->" + t.getName() + ":t->" + title + ":kw->" + keyword + ":kws->" + keywords;
jsonObject = JSONObject.parseObject(resJsonStr);
long beforeReturn = System.currentTimeMillis();
System.out.println("searchES:" + searchESTimeMillisSpent + "inMethod2BeforeReturn:" + (beforeReturn - startMethod) + "thread:" + debug);
return new ResponseEntity<JSONObject>(jsonObject, httpStatus);
} java -jar target/springMybatis-1.0-SNAPSHOT.jar -Xms2g -Xmx2g 对接口发起百次请求,统计区间断点时间、最值时间、平均值时间
spring boot tomcat 线程数 修改初始线程数 统计性能 每百次请求耗时的更多相关文章
- spring cloud spring boot JPA 克隆对象修改属性后 无法正常的执行save方法进行保存或者更新
2019-12-1220:34:58 spring cloud spring boot JPA 克隆对象修改属性后 无法正常的执行save方法进行保存或者更新 未解决
- Spring boot中最大连接数、最大线程数与最大等待数在生产中的异常场景
在上周三下午时,客户.业务和测试人员同时反溃生产环境登录进入不了系统,我亲自测试时,第一次登录进去了,待退出后再登录时,复现了客户的问题,场景像是请求连接被拒绝了,分析后判断是spring boot的 ...
- Spring Boot tomcat
定制内嵌 Tomcat 设置内嵌Tomcat的端口 Spring Boot 内嵌的 Tomcat 服务器默认运行在 8080 端口.如果,我们需要修改Tomcat的端口,我们可以在 src/main/ ...
- 如何配置Spring Boot Tomcat
1.概述 Spring Boot Web应用程序默认包含预配置的嵌入式Web服务器.但在某些情况下,我们要修改默认配置以满足自定义要求. 在本教程中,我们将介绍通过application.proper ...
- spring boot tomcat 打本地包成war,通过Tomcat启动时出现问题: ZipException: error in opening zip file
一个第三方公司提供spring boot 项目,直接启动是ok的, 但是打包成war,通过Tomcat启动,就出现 ZipException: error in opening zip file: 2 ...
- Spring Boot Tomcat配置详解
参数配置容器 server.xx开头的是所有servlet容器通用的配置,server.tomcat.xx开头的是tomcat特有的参数,其它类似. 所有参数绑定配置类:org.springframe ...
- 【spring boot】spring boot的自定义banner修改+spring boot启动项目图标修改
1.启动Spring Boot项目后会看到这样的图案,这个图片其实是可以自定义的,打开网站 http://patorjk.com/software/taag/#p=display&h=3&am ...
- spring boot tomcat 部署
前几天springboot项目部署到linux中,整个过程就是个坑啊.踩坑的过程中也学到了许多.spring boot 项目部署时由于其内置了tomcat和jdk,而且还都是8. 所以部署的话就分为两 ...
- Spring Boot入门(12)实现页面访问量统计功能
在日常的网站使用中,经常会碰到页面的访问量(或者访问者人数)统计.那么,在Spring Boot中该如何实现这个功能呢? 我们的想法是比较简单的,那就是将访问量储存在某个地方,要用的时候取出来 ...
随机推荐
- (转)一种开源的跨平台视频开发框架:VideoLAN - VLC media player
VLC原先是几个法国的大学生做的项目,后来他们把VLC作为了一个开源的项目,吸引了来自世界各国的很多优秀程序员来共同编写和维护VLC,才逐渐变成了现在这个样子.至于为什么叫VideoLan Clien ...
- javascript中call、apply、argument、callee、caller
1.Call方法 调用一个对象的一个方法,以另一个对象替换当前对象. call([thisObj[,arg1[, arg2[, [,.argN]]]]]) thisObj 可选项.将被用作当前对象的对 ...
- C# 使用IrisSkin2.dll皮肤库C# ssk皮肤
其实皮肤就是一个第三方的控件,名字是IrisSkin2.dll只要添加到你的工具箱里就可以和其它控件一样使用了下面我说一下使用的方法,不对的地方大家多指教啊. 一.添加控件IrisSkin2.dll. ...
- NSArray打印汉字的方法
(1) NSArray打印汉字 通过重载NSArray的- (NSString *)descriptionWithLocale:(id)locale方法 方法体例如以下: //依据设置的locale ...
- Cookie文件格式解析
原文参考:http://blog.csdn.net/lixianlin/article/details/2738229 1.Cookie文件的实质 Cookie实际上是Web服务端与客户端(典型的是浏 ...
- [spring] 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 26 in XML document from ...
- PHP-003
PHP函数大全(转) usleep() 函数延迟代码执行若干微秒.unpack() 函数从二进制字符串对数据进行解包.uniqid() 函数基于以微秒计的当前时间,生成一个唯一的 ID.time_sl ...
- python2.0_s12_day9_协程&Gevent协程
Python之路,Day9 - 异步IO\数据库\队列\缓存 本节内容 Gevent协程 Select\Poll\Epoll异步IO与事件驱动 Python连接Mysql数据库操作 协程 1.协程,又 ...
- Python 入门(三)整数和浮点数+布尔类型
整数和浮点数 Python支持对整数和浮点数直接进行四则混合运算,运算规则和数学上的四则运算规则完全一致. 基本的运算: 1 + 2 + 3 # ==> 6 4 * 5 - 6 # ==> ...
- Navicat无法启动,提示无法启动程序,因为计算机中丢失MSVCP140.dll
.dll是一个动态链接库文件,Dynamic Link Library,是代码的封装,提供某种功能,可以被需要该功能的多个应用调用,提高代码的复用性 解决方法,下载并安装微软VC++2015版运行库 ...