本课程将为你讲解如何在生产环境下对Java应用做性能监控与调优;通过本课程,你将掌握多种性能监控工具应用,学会定位并解决诸如内存溢出、cpu负载飙高等问题;学会线上代码调试,Tomcat、Nginx,GC调优等手段; 读懂JVM字节码指令,分析源码背后原理,提升应对线上突发状况的能力
适合人群
具备至少一个项目开发和上线经验的同学
想学习生产环境下应用监控与调优技术的同学
想提高解决生产环境的各种性能问题的能力的同学
正准备晋级Java中高级工程师的同学
技术储备要求
有Java,Linux,Tomcat,Nginx等
Java初中级工程师必备技术基础
package com.yky.logic.test;
import java.io.File;
import org.apache.catalina.core.AprLifecycleListener;
import org.apache.catalina.core.StandardServer;
import org.apache.catalina.startup.Tomcat;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
TOMCAT
*/
public class EmbeddedTomcat {
private final Logger log = LogManager.getLogger(EmbeddedTomcat.class);
private static String CONTEXT_PATH = "/cis";
private static String PROJECT_PATH = System.getProperty("user.dir");
private static String WEB_APP_PATH = PROJECT_PATH + File.separatorChar + "src/main/webapp";
private static int PORT = 8080;
private Tomcat tomcat = new Tomcat();
public void start() throws Exception {
tomcat.setPort(PORT);
tomcat.setBaseDir(WEB_APP_PATH);
tomcat.getHost().setAppBase(WEB_APP_PATH);
StandardServer server = (StandardServer) tomcat.getServer();
AprLifecycleListener listener = new AprLifecycleListener();
server.addLifecycleListener(listener);
tomcat.addWebapp(CONTEXT_PATH, WEB_APP_PATH);
tomcat.enableNaming();
tomcat.start();
tomcat.getServer().await();
log.info("============== Tomcat 启动 ==============");
}
public void stop() throws Exception {
tomcat.stop();
log.info("============== Tomcat 终止 ==============");
}
/
@param args
@throws Exception
*/
public static void main(String[] args) throws Exception {
EmbeddedTomcat embededTomcat = new EmbeddedTomcat();
embededTomcat.start();
}