Skip to content

Instantly share code, notes, and snippets.


bohr bohrqiu

View GitHub Profile
bohrqiu /
Created Dec 11, 2017 — forked from denji/
NGINX tuning for best performance

Moved to git repository:

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

bohrqiu /
Created Nov 5, 2015
DataSourceHealthIndicator with timeout
* Copyright 2012-2015 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
bohrqiu / .xml
Created Aug 18, 2015
build source to binary jar
View .xml
View gist:c8d8d19b9ed179d46390
public class AsyncController {
private static final Logger logger = LoggerFactory.getLogger(AsyncController.class);
private static AtomicInteger ai = new AtomicInteger();
private UserQueryService userQueryService;
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10);
bohrqiu / gist:40fdc0734f171eb5486e
Created Sep 23, 2014
View gist:40fdc0734f171eb5486e
for pid in `ps -ef |grep java| grep -v 'grep'| awk '{print $2}'`
cat /proc/$pid/status |grep Threads | awk '{print $2}'
View gist:1f32d3575e89ec09e8d5
MAVEN_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8765'


这里通常使用套接字传输。但是在 Windows 平台上也可以使用共享内存传输。


bohrqiu / monitor_create_thread
Last active Aug 29, 2015
btrace script monitor create new thread
View monitor_create_thread
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
public class TracingScript {
public static int count = 0;
@OnMethod(clazz = "java.lang.Thread", method = "start")
public static void onNewThread() {
bohrqiu / gist:817669f38261104c31d8
Created Aug 21, 2014
tomcat-maven-plugin config ssl
View gist:817669f38261104c31d8
bohrqiu /
Last active Apr 24, 2017
package bohr.javassist;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.CtNewMethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.beans.BeanInfo;
bohrqiu /
Last active Nov 22, 2016
http request 转换为对象
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.core.convert.converter.Converter;