mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-25 14:42:52 +00:00
Add named pipe server thread pool.
This commit is contained in:
@@ -53,6 +53,8 @@ static void usage ()
|
||||
|
||||
#define SEAFILE_RPC_PIPE_NAME "seafile.sock"
|
||||
|
||||
#define NAMED_PIPE_SERVER_THREAD_POOL_SIZE 50
|
||||
|
||||
static void start_rpc_service (const char *seafile_dir)
|
||||
{
|
||||
SearpcNamedPipeServer *rpc_server = NULL;
|
||||
@@ -756,7 +758,8 @@ static void start_rpc_service (const char *seafile_dir)
|
||||
searpc_signature_int__string_string_int());
|
||||
|
||||
pipe_path = g_build_path ("/", seafile_dir, SEAFILE_RPC_PIPE_NAME, NULL);
|
||||
rpc_server = searpc_create_named_pipe_server(pipe_path);
|
||||
rpc_server = searpc_create_named_pipe_server(pipe_path, NAMED_PIPE_SERVER_THREAD_POOL_SIZE);
|
||||
|
||||
g_free(pipe_path);
|
||||
if (!rpc_server) {
|
||||
seaf_warning ("Failed to create rpc server.\n");
|
||||
|
@@ -29,10 +29,6 @@
|
||||
#define CONNECT_INTERVAL_MSEC 10 * 1000
|
||||
|
||||
#define DEFAULT_THREAD_POOL_SIZE 500
|
||||
#define DEFAULT_RPC_THREAD_POOL_SIZE 10
|
||||
|
||||
static int
|
||||
load_thread_pool_config (SeafileSession *session);
|
||||
|
||||
SeafileSession *
|
||||
seafile_session_new(const char *central_config_dir,
|
||||
@@ -99,12 +95,6 @@ seafile_session_new(const char *central_config_dir,
|
||||
session->cfg_mgr = seaf_cfg_manager_new (session);
|
||||
if (!session->cfg_mgr)
|
||||
goto onerror;
|
||||
|
||||
if (load_thread_pool_config (session) < 0) {
|
||||
seaf_warning ("Failed to load thread pool config.\n");
|
||||
goto onerror;
|
||||
}
|
||||
|
||||
session->fs_mgr = seaf_fs_manager_new (session, abs_seafile_dir);
|
||||
if (!session->fs_mgr)
|
||||
goto onerror;
|
||||
@@ -141,7 +131,7 @@ seafile_session_new(const char *central_config_dir,
|
||||
if (!session->copy_mgr)
|
||||
goto onerror;
|
||||
|
||||
session->job_mgr = ccnet_job_manager_new (session->sync_thread_pool_size);
|
||||
session->job_mgr = ccnet_job_manager_new (DEFAULT_THREAD_POOL_SIZE);
|
||||
|
||||
session->size_sched = size_scheduler_new (session);
|
||||
|
||||
@@ -239,31 +229,6 @@ seafile_session_start (SeafileSession *session)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
load_thread_pool_config (SeafileSession *session)
|
||||
{
|
||||
int rpc_tp_size, sync_tp_size;
|
||||
|
||||
rpc_tp_size = g_key_file_get_integer (session->config,
|
||||
"thread pool size", "rpc",
|
||||
NULL);
|
||||
sync_tp_size = g_key_file_get_integer (session->config,
|
||||
"thread pool size", "sync",
|
||||
NULL);
|
||||
|
||||
if (rpc_tp_size > 0)
|
||||
session->rpc_thread_pool_size = rpc_tp_size;
|
||||
else
|
||||
session->rpc_thread_pool_size = DEFAULT_RPC_THREAD_POOL_SIZE;
|
||||
|
||||
if (sync_tp_size > 0)
|
||||
session->sync_thread_pool_size = sync_tp_size;
|
||||
else
|
||||
session->sync_thread_pool_size = DEFAULT_THREAD_POOL_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
get_system_default_repo_id (SeafileSession *session)
|
||||
{
|
||||
|
@@ -64,9 +64,6 @@ struct _SeafileSession {
|
||||
|
||||
int cloud_mode;
|
||||
|
||||
int rpc_thread_pool_size;
|
||||
int sync_thread_pool_size;
|
||||
|
||||
HttpServerStruct *http_server;
|
||||
ZipDownloadMgr *zip_download_mgr;
|
||||
IndexBlksMgr *index_blocks_mgr;
|
||||
|
Reference in New Issue
Block a user