目的
- 了解JAVA程序性能调优的过程、原理以及常见方法;在这方面做到“知道自己不知道”;
- 不用了解太多细节,这些细节的学习需要结合大量实践,只能有机会再深入。
TODO/疑问
- 为什么优化GC时,要按照“确定内存需求" -> "延迟调优" -> "吞吐量调优"的顺序? 是因为这些指标之间存在该顺序表明的依赖关系?
- 如何定义性能需求?
public boolean forward(HttpServletRequest request, HttpServletResponse response , String serviceName) throws IOException { | |
String[] serviceNames = forwardname.split(";"); | |
String requestURI = request.getRequestURI();//获取请求URI | |
String queryParam=request.getQueryString();//获取请求url中的参数 | |
String url= targetUrl + requestURI; | |
if(StringUtils.isNoneBlank(queryParam)) { | |
url = url + "?" + queryParam; | |
} | |
logger.info(serviceName + "=================== forward to " + url ); |
@RestController | |
@RequestMapping(GraphDBController.DELEGATE_PREFIX) | |
@Api(value = "GraphDB", tags = { | |
"graphdb-Api" | |
}) | |
public class GraphDBController { | |
@Autowired | |
GraphProperties graphProperties; |
import org.springframework.http.*; | |
import org.springframework.stereotype.Service; | |
import org.springframework.util.MultiValueMap; | |
import org.springframework.util.StreamUtils; | |
import org.springframework.web.client.RestTemplate; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import java.io.IOException; | |
import java.io.InputStream; |
目的
TODO/疑问
#!/bin/bash | |
# A script to set up a new mac. Uses bash, homebrew, etc. | |
# Focused for ruby/rails development. Includes many utilities and apps: | |
# - homebrew, rvm, node | |
# - quicklook plugins, terminal fonts | |
# - browsers: chrome, firefox | |
# - dev: iterm2, sublime text, postgres, chrome devtools, etc. | |
# - team: slack, dropbox, google drive, skype, etc |
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:
This process will work with either a qcow2
or raw
disk image. For
package samples | |
import org.junit.runner.RunWith | |
import org.scalatest.junit.JUnitRunner | |
import org.scalatest._ | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.context.annotation._ | |
import org.springframework.stereotype.Service | |
import org.springframework.test.context.support.AnnotationConfigContextLoader | |
import org.springframework.test.context.{ActiveProfiles, ContextConfiguration, TestContextManager} |
object Application { | |
def main(args: Array[String]) : Unit = SpringApplication.run(classOf[ApplicationConfig], args :_ *) | |
} |
#!/bin/bash | |
# Perform installation as root | |
# Install prereqs | |
yum -y install libcurl libcurl-devel rrdtool rrdtool-devel rrdtool-prel libgcrypt-devel gcc make gcc-c++ | |
# Get Collectd, untar it, make it and install | |
wget http://collectd.org/files/collectd-5.4.0.tar.gz | |
tar zxvf collectd-5.4.0.tar.gz |