Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

von gosling vongosling

🎯
Focusing
Block or report user

Report or block vongosling

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vongosling
vongosling / gist:11020739
Created Apr 18, 2014
Feeds system Result List based cursor theory
View gist:11020739
/**
* Result List based cursor theory
*
* @author vongosling
* @param <T>
*/
public class ResultCursorList<T> extends BaseDo {
private static final long serialVersionUID = -6593448580923210640L;
/**
@vongosling
vongosling / gist:10353488
Created Apr 10, 2014
High performance Hessian Serialization and Derialization
View gist:10353488
package com.alibaba.mq.internal.tools;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
import com.caucho.hessian.io.Hessian2Input;
import com.caucho.hessian.io.Hessian2Output;
import com.caucho.hessian.io.SerializerFactory;
@vongosling
vongosling / gist:9929680
Last active Nov 1, 2019
Performance Tuning
View gist:9929680

LInux

Three system configuration parameters must be set to support a large number of open files and TCP connections with large bursts of messages. Changes can be made using the /etc/rc.d/rc.local or /etc/sysctl.conf script to preserve changes after reboot.

1. /proc/sys/fs/file-max: The maximum number of concurrently open files.

fs.file-max = 1000000

2. /proc/sys/net/ipv4/tcp_max_syn_backlog: Maximum number of remembered connection requests, which are still did not receive an acknowledgment from connecting client. The default value is 1024 for systems with more than 128Mb of memory, and 128 for low memory machines.

net.ipv4.tcp_max_syn_backlog = 3240000

3. /proc/sys/net/core/somaxconn: Limit of socket listen() backlog, known in userspace as SOMAXCONN. Defaults to 128.

net.core.somaxconn = 3240000
@vongosling
vongosling / gist:9661145
Last active Aug 29, 2015
Performance analyzer v1.1.0
View gist:9661145
import java.io.IOException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletionService;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
@vongosling
vongosling / gist:9461205
Created Mar 10, 2014
how-to-use-makefiles-in-your-web-projects
@vongosling
vongosling / gist:8970351
Created Feb 13, 2014
Best practice - Httpclient 4.1
View gist:8970351
/**
* 史上最棒的HttpClient4封装,details please see
* http://hc.apache.org/httpcomponents-client-ga/tutorial/html/index.html
*
* @author von gosling 2013-5-7
*/
public class HttpClientManager {
//Consider ulimit
private static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 7500;
@vongosling
vongosling / gist:8970307
Last active Aug 29, 2015
Eclipse ADT FAQ:
View gist:8970307

Ubuntu 12.04.4,Kernel 3.5.0-45-generic

Problem 1:

Failed to start emulator: Cannot run program "/usr/bin/android-studio/sdk/tools/emulator": java.io.IOException: error=2

Solution:

sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5

Problem 2:

/android-4.4/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

Solution:

View gist:6944652
Love brevity and simplicity
You can’t perform that action at this time.