ub_server_running
2016-06-22 11:31:05 0 举报
ub_server_running 是一个用于检查服务器运行状态的变量。当服务器正常运行时,该变量的值为 True,表示服务器正在接收和处理请求;而当服务器出现故障或停止运行时,该变量的值为 False,表示服务器当前不可用。通过监控 ub_server_running 变量的值,可以实时了解服务器的运行状况,从而确保应用程序的稳定性和可靠性。在实际开发中,通常会将 ub_server_running 与其他功能模块相结合,例如自动切换到备用服务器、发送告警通知等,以提高系统的容错能力和可用性。总之,ub_server_running 是一个简单而实用的工具,对于保证服务器正常运行至关重要。
作者其他创作
大纲/内容
......
void* user_buf
....................
void* parent
指针service_handler_base*
thread_data
从client fd读入请求内容
12 pointers 1 per threadeach stores addr of athread_instance_data objadjacently allocated in heap
type=void *size=8 bytes
...........................
nshead
mcpack
ub_server_pdata_t
int fd
字符串\"create_direct_trans\"
一个thread的client fd读入的请求放入本thread的read buffer发往该thread的thread_instance_data里面的handlers_ map里面的对应的service_handler_wrapper对象中的handler对象,比如create_direct_trans_service对象的handle函数处理处理的响应也存入本thread的write buffer最终发给本thread的client fd
内部调用obj-handle()
void* data
thread_instance_data
create_direct_trans_service obj
pay_direct_trans_service obj
pthread_t pid
void* write_buf
12 thread_instance_data obj separately allocated in heap
associate with
g_pkey for thread 1
按nshead+mcpack协议解析请求内容供实际各service对象的handle函数内部消费
.................................
ub_server_handle
Stack
void* usersef_buf
each per-thread pointerstores addr of another pointer storing the addr of the per-thread thread_instance_data obj
type=void*size=sizeof(/thread_instance_data**)
1)inside one thread_instance_data its thread_data member variable is used by all service objs like create_direct_trans_serice for construction2)members of thread_data like sql_db_session_map are initialized inside constructors of service classes like create_direct_trans_service
int (* cb_native)()
thread_instance_data for thread 0newed inside dispatcher::create_thread_datahold own map of cmd-service_handler_wrapper*
total size=12*sizeof(void *)there are 12 pointers1 per threadadjacently allocated in heap
.........................
int sev_sock
13 per-thread data key12 worker threads1 main thread
字符串\"pay_direct_trans\"
void* pool
each thread_instance_data objhas its own set of pointerspointing to their own set of service objs like create_direct_trans_serivce
void* read_buf
Heap
g_pkey for thread 12
向client fd写入响应内容
g_pkey for main thread
redis_client *p_redis_client_
Code
按nshead+mcpack协议打包响应内容实际内容由各service对象的handle函数内部填充
int (* cb_drastic)()
use own thread_data for construction
Data
0 条评论
下一页