James Moger
2013-05-03 b58492239c4c3acc3b4434625d08827450fde078
GO NIO connector thread pool size setting
3 files modified
23 ■■■■ changed files
releases.moxie 2 ●●●●● patch | view | raw | blame | history
src/main/distrib/data/gitblit.properties 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/GitBlitServer.java 14 ●●●●● patch | view | raw | blame | history
releases.moxie
@@ -33,6 +33,7 @@
     - Updated Japanese translation
     
    additions: 
     - Added GO http/https connector thread pool size setting
     - Added a server setting to force a particular translation/Locale for all sessions
     - Added smart Git Daemon serving.  If enabled, git:// access will be offered for any repository which permits anonymous access.  If the repository permits anonymous cloning, anonymous git:// clone will be permitted while anonmymous git:// pushes will be rejected.
     - Option to automatically tag branch tips on each push with an incremental revision number
@@ -81,6 +82,7 @@
    - { name: 'git.daemonPort', defaultValue: 0 }
    - { name: 'git.defaultIncrementalPushTagPrefix', defaultValue: 'r' }
    - { name: 'web.forceDefaultLocale', defaultValue: ' ' }
    - { name: 'server.nioThreadPoolSize', defaultValue: 50 }
}
#
src/main/distrib/data/gitblit.properties
@@ -1250,6 +1250,13 @@
# RESTART REQUIRED
server.useNio = true
# If using Jetty NIO connectors, specify the maximum number of concurrent
# http/https worker threads to allow.
#
# SINCE 1.3.0
# RESTART REQUIRED
server.nioThreadPoolSize = 50
# Context path for the GO application.  You might want to change the context
# path if running Gitblit behind a proxy layer such as mod_proxy.
#
src/main/java/com/gitblit/GitBlitServer.java
@@ -203,7 +203,7 @@
        // conditionally configure the http connector
        if (params.port > 0) {
            Connector httpConnector = createConnector(params.useNIO, params.port);
            Connector httpConnector = createConnector(params.useNIO, settings.getInteger(Keys.server.nioThreadPoolSize, 50), params.port);
            String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
            if (!StringUtils.isEmpty(bindInterface)) {
                logger.warn(MessageFormat.format("Binding connector on port {0,number,0} to {1}",
@@ -262,7 +262,7 @@
            if (serverKeyStore.exists()) {                
                Connector secureConnector = createSSLConnector(params.alias, serverKeyStore, serverTrustStore, params.storePassword,
                        caRevocationList, params.useNIO, params.securePort, params.requireClientCertificates);
                        caRevocationList, params.useNIO, settings.getInteger(Keys.server.nioThreadPoolSize, 50), params.securePort, params.requireClientCertificates);
                String bindInterface = settings.getString(Keys.server.httpsBindInterface, null);
                if (!StringUtils.isEmpty(bindInterface)) {
                    logger.warn(MessageFormat.format(
@@ -410,15 +410,16 @@
     * 
     * @param useNIO
     * @param port
     * @param maxThreads
     * @return an http connector
     */
    private Connector createConnector(boolean useNIO, int port) {
    private Connector createConnector(boolean useNIO, int port, int maxThreads) {
        Connector connector;
        if (useNIO) {
            logger.info("Setting up NIO SelectChannelConnector on port " + port);
            SelectChannelConnector nioconn = new SelectChannelConnector();
            nioconn.setSoLingerTime(-1);
            nioconn.setThreadPool(new QueuedThreadPool(20));
            nioconn.setThreadPool(new QueuedThreadPool(maxThreads));
            connector = nioconn;
        } else {
            logger.info("Setting up SocketConnector on port " + port);
@@ -443,12 +444,13 @@
     * @param storePassword
     * @param caRevocationList
     * @param useNIO
     * @param nioThreadPoolSize
     * @param port
     * @param requireClientCertificates
     * @return an https connector
     */
    private Connector createSSLConnector(String certAlias, File keyStore, File clientTrustStore,
            String storePassword, File caRevocationList, boolean useNIO, int port,
            String storePassword, File caRevocationList, boolean useNIO,  int nioThreadPoolSize, int port,
            boolean requireClientCertificates) {
        GitblitSslContextFactory factory = new GitblitSslContextFactory(certAlias,
                keyStore, clientTrustStore, storePassword, caRevocationList);
@@ -462,7 +464,7 @@
            } else {
                factory.setWantClientAuth(true);
            }
            ssl.setThreadPool(new QueuedThreadPool(20));
            ssl.setThreadPool(new QueuedThreadPool(nioThreadPoolSize));
            connector = ssl;
        } else {
            logger.info("Setting up NIO SslSocketConnector on port " + port);