Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
5c2f873f
Commit
5c2f873f
authored
Dec 09, 2014
by
daryl herzmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #135 from tevans/OF-857
OF-857: Improve thread pool management
parents
56b2d7b5
3032cc84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
AdminConsolePlugin.java
...g/jivesoftware/openfire/container/AdminConsolePlugin.java
+10
-4
HttpBindManager.java
src/java/org/jivesoftware/openfire/http/HttpBindManager.java
+14
-14
HttpSessionManager.java
...va/org/jivesoftware/openfire/http/HttpSessionManager.java
+1
-1
No files found.
src/java/org/jivesoftware/openfire/container/AdminConsolePlugin.java
View file @
5c2f873f
...
@@ -97,10 +97,13 @@ public class AdminConsolePlugin implements Plugin {
...
@@ -97,10 +97,13 @@ public class AdminConsolePlugin implements Plugin {
certificateListener
=
new
CertificateListener
();
certificateListener
=
new
CertificateListener
();
CertificateManager
.
addListener
(
certificateListener
);
CertificateManager
.
addListener
(
certificateListener
);
// the number of threads allocated to each connector/port
int
serverThreads
=
JiveGlobals
.
getXMLProperty
(
"adminConsole.serverThreads"
,
2
);
adminPort
=
JiveGlobals
.
getXMLProperty
(
"adminConsole.port"
,
9090
);
adminPort
=
JiveGlobals
.
getXMLProperty
(
"adminConsole.port"
,
9090
);
adminSecurePort
=
JiveGlobals
.
getXMLProperty
(
"adminConsole.securePort"
,
9091
);
adminSecurePort
=
JiveGlobals
.
getXMLProperty
(
"adminConsole.securePort"
,
9091
);
final
QueuedThreadPool
tp
=
new
QueuedThreadPool
(
16
,
2
);
final
QueuedThreadPool
tp
=
new
QueuedThreadPool
();
tp
.
setName
(
"Jetty-QTP-AdminConsole"
);
tp
.
setName
(
"Jetty-QTP-AdminConsole"
);
adminServer
=
new
Server
(
tp
);
adminServer
=
new
Server
(
tp
);
...
@@ -118,9 +121,10 @@ public class AdminConsolePlugin implements Plugin {
...
@@ -118,9 +121,10 @@ public class AdminConsolePlugin implements Plugin {
if
(
adminPort
>
0
)
{
if
(
adminPort
>
0
)
{
httpConfig
=
new
HttpConfiguration
();
httpConfig
=
new
HttpConfiguration
();
httpConnector
=
new
ServerConnector
(
adminServer
,
-
1
,
serverThreads
);
// Do not send Jetty info in HTTP headers
// Do not send Jetty info in HTTP headers
httpConfig
.
setSendServerVersion
(
false
);
httpConfig
.
setSendServerVersion
(
false
);
httpConnector
=
new
ServerConnector
(
adminServer
,
new
HttpConnectionFactory
(
httpConfig
));
httpConnector
.
addConnectionFactory
(
new
HttpConnectionFactory
(
httpConfig
));
// Listen on a specific network interface if it has been set.
// Listen on a specific network interface if it has been set.
String
bindInterface
=
getBindInterface
();
String
bindInterface
=
getBindInterface
();
httpConnector
.
setHost
(
bindInterface
);
httpConnector
.
setHost
(
bindInterface
);
...
@@ -161,7 +165,9 @@ public class AdminConsolePlugin implements Plugin {
...
@@ -161,7 +165,9 @@ public class AdminConsolePlugin implements Plugin {
HttpConnectionFactory
httpConnectionFactory
=
new
HttpConnectionFactory
(
httpsConfig
);
HttpConnectionFactory
httpConnectionFactory
=
new
HttpConnectionFactory
(
httpsConfig
);
SslConnectionFactory
sslConnectionFactory
=
new
SslConnectionFactory
(
sslContextFactory
,
org
.
eclipse
.
jetty
.
http
.
HttpVersion
.
HTTP_1_1
.
toString
());
SslConnectionFactory
sslConnectionFactory
=
new
SslConnectionFactory
(
sslContextFactory
,
org
.
eclipse
.
jetty
.
http
.
HttpVersion
.
HTTP_1_1
.
toString
());
httpsConnector
=
new
ServerConnector
(
adminServer
,
sslConnectionFactory
,
httpConnectionFactory
);
httpsConnector
=
new
ServerConnector
(
adminServer
,
-
1
,
serverThreads
);
httpsConnector
.
addConnectionFactory
(
sslConnectionFactory
);
httpsConnector
.
addConnectionFactory
(
httpConnectionFactory
);
}
}
String
bindInterface
=
getBindInterface
();
String
bindInterface
=
getBindInterface
();
...
@@ -192,7 +198,7 @@ public class AdminConsolePlugin implements Plugin {
...
@@ -192,7 +198,7 @@ public class AdminConsolePlugin implements Plugin {
adminServer
.
start
();
adminServer
.
start
();
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
Log
.
error
(
"Could not start admin con
os
le server"
,
e
);
Log
.
error
(
"Could not start admin con
so
le server"
,
e
);
}
}
// Log the ports that the admin server is listening on.
// Log the ports that the admin server is listening on.
...
...
src/java/org/jivesoftware/openfire/http/HttpBindManager.java
View file @
5c2f873f
...
@@ -77,7 +77,7 @@ public final class HttpBindManager {
...
@@ -77,7 +77,7 @@ public final class HttpBindManager {
public
static
final
String
HTTP_BIND_THREADS
=
"httpbind.client.processing.threads"
;
public
static
final
String
HTTP_BIND_THREADS
=
"httpbind.client.processing.threads"
;
public
static
final
int
HTTP_BIND_THREADS_DEFAULT
=
16
;
public
static
final
int
HTTP_BIND_THREADS_DEFAULT
=
8
;
private
static
final
String
HTTP_BIND_FORWARDED
=
"httpbind.forwarded.enabled"
;
private
static
final
String
HTTP_BIND_FORWARDED
=
"httpbind.forwarded.enabled"
;
...
@@ -195,12 +195,13 @@ public final class HttpBindManager {
...
@@ -195,12 +195,13 @@ public final class HttpBindManager {
return
JiveGlobals
.
getBooleanProperty
(
HTTP_BIND_ENABLED
,
HTTP_BIND_ENABLED_DEFAULT
);
return
JiveGlobals
.
getBooleanProperty
(
HTTP_BIND_ENABLED
,
HTTP_BIND_ENABLED_DEFAULT
);
}
}
private
void
createConnector
(
int
port
)
{
private
void
createConnector
(
int
port
,
int
bindThreads
)
{
httpConnector
=
null
;
httpConnector
=
null
;
if
(
port
>
0
)
{
if
(
port
>
0
)
{
HttpConfiguration
httpConfig
=
new
HttpConfiguration
();
HttpConfiguration
httpConfig
=
new
HttpConfiguration
();
configureProxiedConnector
(
httpConfig
);
configureProxiedConnector
(
httpConfig
);
ServerConnector
connector
=
new
ServerConnector
(
httpBindServer
,
new
HttpConnectionFactory
(
httpConfig
));
ServerConnector
connector
=
new
ServerConnector
(
httpBindServer
,
-
1
,
bindThreads
);
connector
.
addConnectionFactory
(
new
HttpConnectionFactory
(
httpConfig
));
// Listen on a specific network interface if it has been set.
// Listen on a specific network interface if it has been set.
connector
.
setHost
(
getBindInterface
());
connector
.
setHost
(
getBindInterface
());
...
@@ -209,7 +210,7 @@ public final class HttpBindManager {
...
@@ -209,7 +210,7 @@ public final class HttpBindManager {
}
}
}
}
private
void
createSSLConnector
(
int
securePort
)
{
private
void
createSSLConnector
(
int
securePort
,
int
bindThreads
)
{
httpsConnector
=
null
;
httpsConnector
=
null
;
try
{
try
{
if
(
securePort
>
0
&&
CertificateManager
.
isRSACertificate
(
SSLConfig
.
getKeyStore
(),
"*"
))
{
if
(
securePort
>
0
&&
CertificateManager
.
isRSACertificate
(
SSLConfig
.
getKeyStore
(),
"*"
))
{
...
@@ -252,8 +253,9 @@ public final class HttpBindManager {
...
@@ -252,8 +253,9 @@ public final class HttpBindManager {
sslConnector
=
new
HTTPSPDYServerConnector
(
httpBindServer
,
sslContextFactory
);
sslConnector
=
new
HTTPSPDYServerConnector
(
httpBindServer
,
sslContextFactory
);
}
else
{
}
else
{
sslConnector
=
new
ServerConnector
(
httpBindServer
,
new
SslConnectionFactory
(
sslContextFactory
,
"http/1.1"
),
sslConnector
=
new
ServerConnector
(
httpBindServer
,
-
1
,
bindThreads
);
new
HttpConnectionFactory
(
httpsConfig
));
sslConnector
.
addConnectionFactory
(
new
SslConnectionFactory
(
sslContextFactory
,
"http/1.1"
));
sslConnector
.
addConnectionFactory
(
new
HttpConnectionFactory
(
httpsConfig
));
}
}
sslConnector
.
setHost
(
getBindInterface
());
sslConnector
.
setHost
(
getBindInterface
());
sslConnector
.
setPort
(
securePort
);
sslConnector
.
setPort
(
securePort
);
...
@@ -512,8 +514,10 @@ public final class HttpBindManager {
...
@@ -512,8 +514,10 @@ public final class HttpBindManager {
* @param securePort the port to start the TLS (secure) HTTP Bind service on.
* @param securePort the port to start the TLS (secure) HTTP Bind service on.
*/
*/
private
synchronized
void
configureHttpBindServer
(
int
port
,
int
securePort
)
{
private
synchronized
void
configureHttpBindServer
(
int
port
,
int
securePort
)
{
int
maxThreads
=
JiveGlobals
.
getIntProperty
(
HTTP_BIND_THREADS
,
HTTP_BIND_THREADS_DEFAULT
);
// this is the number of threads allocated to each connector/port
final
QueuedThreadPool
tp
=
new
QueuedThreadPool
(
maxThreads
,
getMinThreads
(
maxThreads
));
int
bindThreads
=
JiveGlobals
.
getIntProperty
(
HTTP_BIND_THREADS
,
HTTP_BIND_THREADS_DEFAULT
);
final
QueuedThreadPool
tp
=
new
QueuedThreadPool
();
tp
.
setName
(
"Jetty-QTP-BOSH"
);
tp
.
setName
(
"Jetty-QTP-BOSH"
);
httpBindServer
=
new
Server
(
tp
);
httpBindServer
=
new
Server
(
tp
);
...
@@ -522,8 +526,8 @@ public final class HttpBindManager {
...
@@ -522,8 +526,8 @@ public final class HttpBindManager {
httpBindServer
.
addBean
(
jmx
.
getContainer
());
httpBindServer
.
addBean
(
jmx
.
getContainer
());
}
}
createConnector
(
port
);
createConnector
(
port
,
bindThreads
);
createSSLConnector
(
securePort
);
createSSLConnector
(
securePort
,
bindThreads
);
if
(
httpConnector
==
null
&&
httpsConnector
==
null
)
{
if
(
httpConnector
==
null
&&
httpsConnector
==
null
)
{
httpBindServer
=
null
;
httpBindServer
=
null
;
return
;
return
;
...
@@ -544,10 +548,6 @@ public final class HttpBindManager {
...
@@ -544,10 +548,6 @@ public final class HttpBindManager {
collection
.
setHandlers
(
new
Handler
[]
{
contexts
,
new
DefaultHandler
()
});
collection
.
setHandlers
(
new
Handler
[]
{
contexts
,
new
DefaultHandler
()
});
}
}
private
int
getMinThreads
(
int
maxThreads
)
{
return
(
maxThreads
/
4
)+
1
;
}
private
void
createBoshHandler
(
ContextHandlerCollection
contexts
,
String
boshPath
)
private
void
createBoshHandler
(
ContextHandlerCollection
contexts
,
String
boshPath
)
{
{
ServletContextHandler
context
=
new
ServletContextHandler
(
contexts
,
boshPath
,
ServletContextHandler
.
SESSIONS
);
ServletContextHandler
context
=
new
ServletContextHandler
(
contexts
,
boshPath
,
ServletContextHandler
.
SESSIONS
);
...
...
src/java/org/jivesoftware/openfire/http/HttpSessionManager.java
View file @
5c2f873f
...
@@ -88,7 +88,7 @@ public class HttpSessionManager {
...
@@ -88,7 +88,7 @@ public class HttpSessionManager {
int
maxPoolSize
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.threads"
,
int
maxPoolSize
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.threads"
,
// use deprecated property as default (shared with ConnectionManagerImpl)
// use deprecated property as default (shared with ConnectionManagerImpl)
JiveGlobals
.
getIntProperty
(
"xmpp.client.processing.threads"
,
16
));
JiveGlobals
.
getIntProperty
(
"xmpp.client.processing.threads"
,
8
));
int
keepAlive
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.timeout"
,
60
);
int
keepAlive
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.timeout"
,
60
);
sendPacketPool
=
new
ThreadPoolExecutor
(
getCorePoolSize
(
maxPoolSize
),
maxPoolSize
,
keepAlive
,
TimeUnit
.
SECONDS
,
sendPacketPool
=
new
ThreadPoolExecutor
(
getCorePoolSize
(
maxPoolSize
),
maxPoolSize
,
keepAlive
,
TimeUnit
.
SECONDS
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment