Feature cache client

This commit is contained in:
郑超
2019-01-11 22:38:07 +08:00
parent 6d33ec5891
commit f5c153c59e
8 changed files with 313 additions and 40 deletions

View File

@@ -394,6 +394,7 @@ int main(int argc, char **argv)
pthread_attr_t attr;
void *runtime_log;
struct filecontentcmd filecmd;
time_t now, remain;
struct event ev_timer;
struct timeval tv;
@@ -431,7 +432,9 @@ int main(int argc, char **argv)
}
ev_base = event_base_new();
tv.tv_sec = 10;
now = time(NULL);
remain = 10 - (now % 10);
tv.tv_sec = remain;
tv.tv_usec = 0;
evtimer_assign(&ev_timer, ev_base, timer_cb, &ev_timer);
evtimer_add(&ev_timer, &tv);

BIN
cache/test/lib/libtango_cache_client.a vendored Normal file

Binary file not shown.

View File

@@ -1,35 +1,42 @@
[TANGO_CACHE]
#Addresses of minio. Format is defined by WiredLB.
MINIO_IP_LIST=10.3.35.1;
MINIO_LISTEN_PORT=9000
minio_ip_list=10.3.35.60-61;
minio_listen_port=9000
#Maximum number of connections opened by per host.
#MAX_CONNECTION_PER_HOST=1
#max_connection_per_host=1
#Maximum number of requests in a pipeline.
#MAX_CNNT_PIPELINE_NUM=20
#max_cnnt_pipeline_num=20
#Maximum parellel sessions(http and redis) is allowed to open.
#MAX_CURL_SESSION_NUM=100
#max_curl_session_num=100
#Maximum time the request is allowed to take(seconds).
#MAX_CURL_TRANSFER_TIMEOUT_S=0
#max_curl_transfer_timeout_s=0
#Bucket name in minio.
CACHE_BUCKET_NAME=openbucket
cache_bucket_name=openbucket
#Maximum size of memory used by tango_cache_client. Upload will fail if the current size of memory used exceeds this value.
MAX_USED_MEMORY_SIZE_MB=5120
max_used_memory_size_mb=5120
#Default TTL of objects, i.e. the time after which the object will expire(minumun 60s, i.e. 1 minute).
CACHE_DEFAULT_TTL_SECOND=3600
cache_default_ttl_second=3600
#Whether to hash the object key before cache actions. GET/PUT may be faster if you open it.
CACHE_OBJECT_KEY_HASH_SWITCH=1
cache_object_key_hash_switch=1
#Store way: 0-MINIO; 1-META in REDIS, object in minio; 2-META and small object in Redis, large object in minio;
CACHE_STORE_OBJECT_WAY=2
#If CACHE_STORE_OBJECT_WAY is 2 and the size of a object is not bigger than this value, object will be stored in redis.
REDIS_CACHE_OBJECT_SIZE=20480
#If CACHE_STORE_OBJECT_WAY is not 0, we will use redis to store meta and object.
REDIS_CLUSTER_ADDRS=10.4.35.33:9001,10.4.35.34:9001
cache_store_object_way=2
#If cache_store_object_way is 2 and the size of a object is not bigger than this value, object will be stored in redis.
redis_cache_object_size=20480
#If cache_store_object_way is not 0, we will use redis to store meta and object.
redis_cluster_ip_list=10.4.35.33-34;
redis_cluster_port_range=9001-9016;
#Configs of WiredLB for Minios load balancer.
#WIREDLB_OVERRIDE=1
#WIREDLB_TOPIC=
#WIREDLB_DATACENTER=
WIREDLB_HEALTH_PORT=52101
#WIREDLB_GROUP=
#wiredlb_override=1
#wiredlb_topic=
#wiredlb_datacenter=
wiredlb_health_port=52102
#wiredlb_group=
log_fsstat_appname=TANGO_CACHE
log_fsstat_filepath=./field_stat.log
log_fsstat_interval=10
log_fsstat_trig=1
log_fsstat_dst_ip=127.0.0.1
log_fsstat_dst_port=8125

View File

@@ -329,7 +329,7 @@ static void dummy_accept_callback(evutil_socket_t fd, short events, void *arg)
tango_cache_update_frag_data(ctx, buffer, n);
}
fclose(fp);
if(tango_cache_update_end(ctx, pdata->filename, 256))
if(tango_cache_update_end(ctx, pdata->filename, 256) < 0)
{
put_future_failed(FUTURE_ERROR_CANCEL, "", pdata);
}