summaryrefslogtreecommitdiffstats
path: root/code/jasmine/server-tcp.c
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-05-04 00:55:33 -0400
committerZhijiang Hu <hu.zhijiang@zte.com.cn>2017-05-04 01:14:50 -0400
commit779440ef6064b2d1f2a5004bd92ae3660bc9b63a (patch)
treeb96a9f13a8d06b700eadb4f1a911699cf15e6588 /code/jasmine/server-tcp.c
parent4c57d26e33d6cc4ec66968ab488442eb2e730b45 (diff)
Increase PACKETS_PER_BUFFER to 65536
1) This mainly increase PACKETS_PER_BUFFER to 65536 to reduce the frequency of TCP client acks. 2) Also kills TCP_BUFF_SIZE and define each buffer size in a more intuitive way. 3) Free more unused memory to prevent being killed by oom-killer after enlarged PACKETS_PER_BUFFER. 4) Increase client's select() timeout to 20 secs, since we encountered timeout due to CPU busy in the same BM but with 20 VMs. Tested this PS in a 10 VM node env, and it can multicast a 2.7G file to 10 VMs in 6 minutes, while unicast needs 30+ minutes. Change-Id: Iaf862fb1f1259cc770f720ccdd95dcc281aef262 Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
Diffstat (limited to 'code/jasmine/server-tcp.c')
-rwxr-xr-xcode/jasmine/server-tcp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/code/jasmine/server-tcp.c b/code/jasmine/server-tcp.c
index c48de77d..49fa4e5e 100755
--- a/code/jasmine/server-tcp.c
+++ b/code/jasmine/server-tcp.c
@@ -25,7 +25,6 @@
#include "server.h"
#define MAX_CLIENTS 128 /* Clients per TCP server */
-#define TCP_BUFF_SIZE 65536
struct cdata {
struct tcpq *tx;
@@ -219,8 +218,9 @@ void accept_clients_may_spawn(struct server_status_data *sdata)
void keep_on_receiving_client_request(struct server_status_data *sdata)
{
- char buf[TCP_BUFF_SIZE];
+ char buf[MAX_REQ_SIZE];
void *cpy;
+ void *anscpy;
struct request_ctl *req;
uint32_t *rqb;
struct packet_ctl *ans;
@@ -270,10 +270,11 @@ void keep_on_receiving_client_request(struct server_status_data *sdata)
total_sz = ans->data_size + sizeof(struct packet_ctl);
log(6, "Send packet %u (%u bytes) on %d",
rqb[rq_index], ans->data_size, sdata->cindex);
- cpy = wrapper_malloc(total_sz);
- memcpy(cpy, ans, total_sz);
- tcpq_queue_tail(cd->tx, cpy, total_sz);
+ anscpy = wrapper_malloc(total_sz);
+ memcpy(anscpy, ans, total_sz);
+ tcpq_queue_tail(cd->tx, anscpy, total_sz);
}
+ free(cpy);
if (rq_index > 0) {
/* Data need to be sent out */
@@ -394,7 +395,7 @@ void handle_pullin_event(struct server_status_data *sdata)
void handle_pullout_event(struct server_status_data *sdata)
{
- char buf[TCP_BUFF_SIZE];
+ char buf[PACKET_SIZE];
struct pollfd *ds;
struct cdata *cd;
long transmit_sz;