Re: [PATCH 9/9] virStream{Recv, Send}All: Increase client buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 04/15/2016 09:51 AM, Michal Privoznik wrote:
> These are wrappers over virStreamRecv and virStreamSend so that
> users have to care about nothing but writing data into / reading
> data from a sink (typically a file). Note, that these wrappers
> are used exclusively on client side as the daemon has slightly
> different approach. Anyway, the wrappers allocate this buffer and
> use it for intermediate data storage until the data is passed to
> stream to send, or to the client application. So far, we are
> using 64KB buffer. This is enough, but suboptimal because server
> can send messages up to VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX bytes
> big (262120B, roughly 256KB). So if we make the buffer this big,
> a single message containing the data is sent instead of for,
                                                          ^^^
I assume you mean, "s/for/four"

John

> which is current situation. This means lower overhead, because
> each message contains a header which needs to be processed, each
> message is processed roughly same amount of time regardless of
> its size, less bytes need to be sent through the wire, and so on.
> Note that since server will never sent us a stream message bigger
> than VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX there's no point in
> sizing up the client buffer past this threshold.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/libvirt-stream.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
> index c16f586..8384b37 100644
> --- a/src/libvirt-stream.c
> +++ b/src/libvirt-stream.c
> @@ -23,6 +23,7 @@
>  #include "datatypes.h"
>  #include "viralloc.h"
>  #include "virlog.h"
> +#include "rpc/virnetprotocol.h"
>  
>  VIR_LOG_INIT("libvirt.stream");
>  
> @@ -330,7 +331,7 @@ virStreamSendAll(virStreamPtr stream,
>                   void *opaque)
>  {
>      char *bytes = NULL;
> -    int want = 1024*64;
> +    size_t want = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
>      int ret = -1;
>      VIR_DEBUG("stream=%p, handler=%p, opaque=%p", stream, handler, opaque);
>  
> @@ -423,7 +424,7 @@ virStreamRecvAll(virStreamPtr stream,
>                   void *opaque)
>  {
>      char *bytes = NULL;
> -    int want = 1024*64;
> +    size_t want = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
>      int ret = -1;
>      VIR_DEBUG("stream=%p, handler=%p, opaque=%p", stream, handler, opaque);
>  
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]