summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-09-16 16:20:25 -0400
committerNathan Straz <nstraz@redhat.com>2013-09-16 16:20:25 -0400
commit28574cb4d104df98b92a9e6ca632729ed6c5fa9a (patch)
treed2f3e5481e0d6b6dca127424f8bd1e5126364b94
parent0570bd953cf3ecd1b58c192a015a6f0d46423852 (diff)
downloadqarsh-28574cb4d104df98b92a9e6ca632729ed6c5fa9a.zip
qarsh-28574cb4d104df98b92a9e6ca632729ed6c5fa9a.tar.gz
qarsh-28574cb4d104df98b92a9e6ca632729ed6c5fa9a.tar.xz
Increase buffer and packet sizes
This coordinates the buffer sizes with the max packet size. qarshd and qarsh will probably break if this value does not match between client and server builds. Also increase the value to reduce overhead. A max packet size of 16k only yields 40MB/s. Increase that to 128k and we can do 500MB/s.
-rw-r--r--qacp.c2
-rw-r--r--qarsh.c2
-rw-r--r--qarsh_packet.h2
-rw-r--r--qarshd.c8
4 files changed, 7 insertions, 7 deletions
diff --git a/qacp.c b/qacp.c
index b944b9b..45ee641 100644
--- a/qacp.c
+++ b/qacp.c
@@ -134,7 +134,7 @@ qacp_sendonefile(const char *host, const char *srcfile, const char *destfile)
ssize_t nbytes;
off_t offset;
struct stat sb;
- const int bufsize = 16384;
+ const int bufsize = QARSH_MAX_PACKET_SIZE/2;
char buf[bufsize];
diff --git a/qarsh.c b/qarsh.c
index c713380..50bde2a 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -45,7 +45,7 @@
#include "hbeat.h"
#define QARSH_MINPORT 5010
-#define QARSH_BUFSIZE 4096
+#define QARSH_BUFSIZE QARSH_MAX_PACKET_SIZE/2
#define CONNECT_TIMEOUT 30
diff --git a/qarsh_packet.h b/qarsh_packet.h
index 578fccb..19ade47 100644
--- a/qarsh_packet.h
+++ b/qarsh_packet.h
@@ -23,7 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#define QARSH_MAX_PACKET_SIZE 32*1024
+#define QARSH_MAX_PACKET_SIZE 128*1024
enum qa_packet_type {
QP_INVALID = 0,
diff --git a/qarshd.c b/qarshd.c
index 7f0f944..8d1a798 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -41,7 +41,7 @@
#include "sockutil.h"
#include "qarsh_packet.h"
-#define QARSHD_BUFSIZE 4096
+#define QARSHD_BUFSIZE QARSH_MAX_PACKET_SIZE/2
/*
* QA Remote Shell Daemon
*/
@@ -283,8 +283,8 @@ handle_qarsh()
int child_status;
struct qa_packet *qp = NULL, *rp = NULL;
int allowed_out = 0, allowed_err = 0; /* number of bytes we can send to client */
- char buf[4096]; /* short term buffer for stdout and stderr */
- char buf_in[4096]; /* long term buffer for stdin */
+ char buf[QARSHD_BUFSIZE]; /* short term buffer for stdout and stderr */
+ char buf_in[QARSHD_BUFSIZE]; /* long term buffer for stdin */
int z_in = 0; /* Number of bytes in stdin buffer */
int eof_in = 0; /* Have we seen EOF on stdin yet? */
int nbytes;
@@ -297,7 +297,7 @@ handle_qarsh()
sa.sa_flags = SA_RESTART;
sigaction(SIGCHLD, &sa, NULL);
- qp = make_qp_data_allow(0, 4096);
+ qp = make_qp_data_allow(0, QARSHD_BUFSIZE);
send_packet(qoutfd, qp);
qpfree(qp);