summaryrefslogtreecommitdiff
path: root/cache
diff options
context:
space:
mode:
authorzhangchengwei <[email protected]>2018-11-05 11:21:43 +0800
committerzhengchao <[email protected]>2018-11-13 10:48:17 +0800
commit1fbaee37a5b45b45a02fac99d3638aac25004cf8 (patch)
tree950b6f6139495bf6867bcd9d2fa7b86460c8bb9f /cache
parent00833c4529b51ea99ae6b70761c36ab8657cf3c5 (diff)
增加curl pipeline数量配置
Diffstat (limited to 'cache')
-rw-r--r--cache/src/tango_cache_client.cpp11
-rw-r--r--cache/src/tango_cache_client_in.h1
2 files changed, 8 insertions, 4 deletions
diff --git a/cache/src/tango_cache_client.cpp b/cache/src/tango_cache_client.cpp
index 54dd8b7..c87e885 100644
--- a/cache/src/tango_cache_client.cpp
+++ b/cache/src/tango_cache_client.cpp
@@ -340,7 +340,7 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *
{
snprintf(ctx->object_key, 256, "%s", meta->url);
}
- if(wired_load_balancer_lookup(instance->wiredlb, meta->url, strlen(meta->url), ctx->hostaddr, 48))
+ if(wired_load_balancer_lookup(instance->wiredlb, ctx->object_key, strlen(ctx->object_key), ctx->hostaddr, 48))
{
instance->error_code = CACHE_ERR_WIREDLB;
instance->statistic.totaldrop_num += 1;
@@ -470,7 +470,7 @@ struct tango_cache_ctx *tango_cache_fetch_prepare(struct tango_cache_instance *i
{
snprintf(ctx->object_key, 256, "%s", meta->url);
}
- if(wired_load_balancer_lookup(instance->wiredlb, meta->url, strlen(meta->url), ctx->hostaddr, 48))
+ if(wired_load_balancer_lookup(instance->wiredlb, ctx->object_key, strlen(ctx->object_key), ctx->hostaddr, 48))
{
instance->error_code = CACHE_ERR_WIREDLB;
instance->statistic.totaldrop_num += 1;
@@ -538,7 +538,7 @@ struct tango_cache_ctx *tango_cache_delete_prepare(struct tango_cache_instance *
{
snprintf(ctx->object_key, 256, "%s", objkey);
}
- if(wired_load_balancer_lookup(instance->wiredlb, objkey, strlen(objkey), ctx->hostaddr, 48))
+ if(wired_load_balancer_lookup(instance->wiredlb, ctx->object_key, strlen(ctx->object_key), ctx->hostaddr, 48))
{
instance->error_code = CACHE_ERR_WIREDLB;
instance->statistic.totaldrop_num += 1;
@@ -779,8 +779,10 @@ static int load_local_configure(struct tango_cache_instance *instance, const cha
u_int32_t intval;
u_int64_t longval;
- MESA_load_profile_uint_def(profile_path, section, "MAX_CONNECTION_PER_HOST", &intval, 0);
+ MESA_load_profile_uint_def(profile_path, section, "MAX_CONNECTION_PER_HOST", &intval, 1);
instance->max_cnn_host = intval;
+ MESA_load_profile_uint_def(profile_path, section, "MAX_CNNT_PIPELINE_NUM", &intval, 20);
+ instance->max_pipeline_num = intval;
MESA_load_profile_uint_def(profile_path, section, "MAX_CURL_SESSION_NUM", &instance->max_session_num, 200);
MESA_load_profile_uint_def(profile_path, section, "MAX_USED_MEMORY_SIZE_MB", &intval, 5120);
longval = intval;
@@ -858,6 +860,7 @@ struct tango_cache_instance *tango_cache_instance_new(struct event_base* evbase,
instance->multi_hd = curl_multi_init();
curl_multi_setopt(instance->multi_hd, CURLMOPT_PIPELINING, CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX);
curl_multi_setopt(instance->multi_hd, CURLMOPT_MAX_HOST_CONNECTIONS, instance->max_cnn_host);
+ curl_multi_setopt(instance->multi_hd, CURLMOPT_MAX_PIPELINE_LENGTH, instance->max_pipeline_num);
curl_multi_setopt(instance->multi_hd, CURLMOPT_SOCKETFUNCTION, curl_socket_function_cb);
curl_multi_setopt(instance->multi_hd, CURLMOPT_SOCKETDATA, instance); //curl_socket_function_cb *userp
curl_multi_setopt(instance->multi_hd, CURLMOPT_TIMERFUNCTION, curl_timer_function_cb);
diff --git a/cache/src/tango_cache_client_in.h b/cache/src/tango_cache_client_in.h
index 123a84d..d795b15 100644
--- a/cache/src/tango_cache_client_in.h
+++ b/cache/src/tango_cache_client_in.h
@@ -71,6 +71,7 @@ struct tango_cache_instance
u_int64_t cache_limit_size;
long max_cnn_host;
long transfer_timeout;//������ʱ������
+ long max_pipeline_num;
u_int32_t max_session_num;
u_int32_t upload_block_size; //minio�ֶ��ϴ������С����
enum CACHE_ERR_CODE error_code;