当前位置: 首页 > news >正文

恩阳建设局网站镇江网站设计建设

恩阳建设局网站,镇江网站设计建设,长春vi设计公司,免费自己制作音乐一、背景 本人电脑性能一般#xff0c;但是拥有着一台高性能的VDI#xff08;虚拟桌面基础架构#xff09;#xff0c;以下是具体的配置 二、问题描述 但是#xff0c;即便是拥有这么高的性能#xff0c;每次运行基于Dubbo微服务架构下的微服务都贼久#xff0c;以下…一、背景 本人电脑性能一般但是拥有着一台高性能的VDI虚拟桌面基础架构以下是具体的配置 二、问题描述 但是即便是拥有这么高的性能每次运行基于Dubbo微服务架构下的微服务都贼久以下是启动一次所消耗的时长 使用百度的时间转换的计算耗时好家伙启动一次竟然要耗时2.2min分钟 跟同事讨论了这个项目的启动时长同事A说是我的IDEA的问题同事B说是我电脑的问题。 本着一探究竟的精神耗时了一个下午我倒要看看究竟是那个应用在拖后腿 三、问题跟踪与解决 3.1 重启IDEA和VDI 重新启动了IDEA。关闭了所有的IDEA中的进程以确保不是IDEA在拖后腿。 重新启动了VDIVDI如果在定期杀毒的话也会拖后进程的。 3.2 关闭devtools模式 热部署一般是开发过程中使用开发者不想因为修改内容后重启server浪费大量的时间,而是希望修改代码后能够快速加载自己修改的方法或者类。节省开发时间为开发者提供改好的开发体验。使用热部署之后它会监督spring项目修改点把修改点的java文件编译成class文件然后替换掉修改前的class文件不用再去重新部署。 之前有尝试过但是各种限制总是不顺利尤其现在有了JRebel这个基本上用不了于是考虑不再使用。 找到POM文件直接注释掉devtools的使用。 关闭devtools模式后的效果并不明显。 3.3 关闭项目启动时初始化字典到缓存的打印 查看打印日志发现总是会输出以下的脚本什么鬼启动一次就打印一次这不是浪费时间吗去掉 JDBC Connection [org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection537236d3] will not be managed by SpringPreparing: select dict_id, dict_name, dict_type, status, create_by, create_time, remark from sys_dict_typeParameters: Columns: dict_id, dict_name, dict_type, status, create_by, create_time, remarkRow: 1, 系统开关, sys_normal_disable, 0, admin, 2018-03-16 11:33:00, 系统开关列表Row: 123, 数据状态, ipds_data_status, 0, admin, 2020-08-11 16:38:25, nullRow: 125, 漏洞类型, idps_loophole_type, 0, admin, 2020-08-12 16:30:22, nullRow: 127, 严重等级, idps_loophole_grade, 0, admin, 2020-08-12 16:34:24, 漏洞严重等级Total: 4 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession636226a9] Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession1a9a2c28] was not registered for synchronization because synchronization is not active JDBC Connection [org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection1287e60e] will not be managed by SpringPreparing: select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from sys_dict_data where status 0 and dict_type ? order by dict_sort ascParameters: sys_normal_disable(String)Columns: dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remarkRow: 6, 1, 正常, 0, sys_normal_disable, , primary, Y, 0, admin, 2018-03-16 11:33:00, 正常状态Row: 7, 2, 停用, 1, sys_normal_disable, , danger, N, 0, admin, 2018-03-16 11:33:00, 停用状态Total: 2因为模块涉及到dict所以很快定位到是数据字典模块的功能。 /** * 项目启动时初始化字典到缓存 */ PostConstruct public void init() {ListSysDictType dictTypeList dictTypeMapper.selectDictTypeAll();for (SysDictType dictType : dictTypeList) {ListSysDictData dictDataList dictDataMapper.selectDictDataByType(dictType.getDictType());DictUtils.setDictCache(dictType.getDictType(), dictDataList);} }这一段代码中使用了PostConstruct这个注解的介绍如下 从Java EE5规范开始Servlet中增加了两个影响Servlet生命周期的注解PostConstruct和PreDestroy这两个注解被用来修饰一个非静态的void()方法。PostConstruct是Java自带的注解在方法上加该注解会在项目启动时执行该方法也可以理解为在spring容器初始化的时候执行该方法。 注意在方法上加PostConstruct注解会在项目启动时执行该方法 因此解决方案也很简单直接注释掉这个注解即可。 3.4 给XXL-job增加一个开关 看以下截图发现每次都会进行XXL-job的init的动作。 溯源这个的打印处发现了如下代码 Bean public XxlJobSpringExecutor xxlJobExecutor() {log.info( xxl-job config init.);XxlJobSpringExecutor xxlJobSpringExecutor new XxlJobSpringExecutor();xxlJobSpringExecutor.setAdminAddresses(adminAddresses);xxlJobSpringExecutor.setAppname(appname);xxlJobSpringExecutor.setAddress(address);xxlJobSpringExecutor.setIp(ip);xxlJobSpringExecutor.setPort(port);xxlJobSpringExecutor.setAccessToken(accessToken);xxlJobSpringExecutor.setLogPath(logPath);xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);return xxlJobSpringExecutor; }难怪了本机每次启动都会把自己注册到XXL-job的服务端。 因此是否可以设计一个开关让本机的服务不注册到XXL-job的服务端呢。于是有了以下的代码改善。 3.4.1 新增一个enabled字段用于动态控制注册动作。 Configuration Slf4j public class XxlJobConfig {Value(${xxl.job.admin.addresses})private String adminAddresses;Value(${xxl.job.accessToken})private String accessToken;Value(${xxl.job.executor.appname})private String appname;Value(${xxl.job.executor.address})private String address;Value(${xxl.job.executor.ip})private String ip;Value(${xxl.job.executor.port})private int port;Value(${xxl.job.executor.logpath})private String logPath;Value(${xxl.job.executor.logretentiondays})private int logRetentionDays;/*** 开关默认关闭*/Value(${xxl.job.enabled})private Boolean enabled;Beanpublic XxlJobSpringExecutor xxlJobExecutor() {if (enabled) {log.info( xxl-job config init.);XxlJobSpringExecutor xxlJobSpringExecutor new XxlJobSpringExecutor();xxlJobSpringExecutor.setAdminAddresses(adminAddresses);xxlJobSpringExecutor.setAppname(appname);xxlJobSpringExecutor.setAddress(address);xxlJobSpringExecutor.setIp(ip);xxlJobSpringExecutor.setPort(port);xxlJobSpringExecutor.setAccessToken(accessToken);xxlJobSpringExecutor.setLogPath(logPath);xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);return xxlJobSpringExecutor;}return null;} }3.4.2 配置文件中新增开关的配置 xxl.job.enabledtrue3.5 关闭断点最重要的点 大家都知道在项目Debug过程中使用Debug模式运行项目会太慢往往会比正常直接运行要慢上将近三倍的时间 但是其中的原因却很少人说的清楚其实是因为使用Debug模式运行时我们会在某些方法上打了断点像我就往往会忘记关闭这些断点而这种情况会出现Method breakpoints may dramatically slow down debugging的提示这类提示有时会提示你有时不会提示你。 解决方案 3.5.1 返选取消所有断点 将Java Method Breakpoints下的选项的勾都去掉。 3.5.2 直接点击静音断点 四、问题验证 Started Application in 19.06 seconds解决后重新使用debug模式启动发现启动时间直接降低下拉啦撒花。
http://www.hkea.cn/news/14292722/

相关文章:

  • 免费建站模板北京微信网站开发报价
  • 宁波企业制作网站营销型网站制作多少钱
  • 甘肃建设厅官方网站seo网站诊断报告
  • 免费地图制作网站怎样自己申请注册公司
  • linux网站建设技术指南 pdf深圳专业网站设计公司
  • 广州seo效果seo 网站优化
  • 重庆seo整站优化福建省住房城乡和建设厅网站
  • 网站建设项目怎么跟进客户html5网页制作案例
  • iis发布php网站wordpress 自定义投稿
  • 上海网站改版哪家好专业的开发网站建设
  • 宣传网站制作方案江西锦宇建设集团有限公司网站
  • 蕲春网站建设北京做网站推广seo
  • 有什么ae做动图的网站wordpress 主题无法更换
  • 为学校网站建设seo自动优化软件下载
  • 用asp做网站有哪些功能国内最大的app开发公司
  • 中国物流网站答题做任务网站
  • 网站平台建设步骤网站建设 微信开发 h5开发
  • 甜点网站建设的功能及意义高校网站建设运维体系问题
  • 网站seo的主要优化内容重庆住房城乡建设厅网站首页
  • 徐州网站建设技术外包厦门网站建设厦门
  • 新闻类网站怎么做建设工程教育网站
  • 建站公司论坛中国互联网协会属于什么单位
  • 有什么网站是做办公家具建设网站怎样做
  • 哪有做网站的公司做网上商城网站
  • 外贸网站支付系统网站 权限
  • 南通通州建设工程质量监督网站高端家具东莞网站建设技术支持
  • 网站pr怎么提升游戏推广平台代理加盟
  • 松江叶榭网站建设拓者设计吧电脑版
  • wordpress能开发商城网站吗咸阳建设局网站
  • 建设工程招聘网网站建设 优化