Skip to content

Instantly share code, notes, and snippets.

View bohrqiu's full-sized avatar

bohr bohrqiu

View GitHub Profile
@bohrqiu
bohrqiu / gist:40fdc0734f171eb5486e
Created September 23, 2014 16:50
查看java进程启动线程数
for pid in `ps -ef |grep java| grep -v 'grep'| awk '{print $2}'`
do
cat /proc/$pid/status |grep Threads | awk '{print $2}'
done
@bohrqiu
bohrqiu / gist:c8d8d19b9ed179d46390
Created July 17, 2015 10:11
spring async web
@RestController
public class AsyncController {
private static final Logger logger = LoggerFactory.getLogger(AsyncController.class);
private static AtomicInteger ai = new AtomicInteger();
@Autowired
private UserQueryService userQueryService;
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10);
@bohrqiu
bohrqiu / .xml
Created August 18, 2015 10:18
build source to binary jar
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@bohrqiu
bohrqiu / DataSourceHealthIndicator.java
Created November 5, 2015 07:47
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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@bohrqiu
bohrqiu / nginx-tuning.md
Created December 11, 2017 14:15 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

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.