[ https://issues.apache.org/jira/browse/GUACAMOLE-1776?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Jumper closed GUACAMOLE-1776. ---------------------------------- Fix Version/s: 1.6.0 Resolution: Done > Base64 encoding of image/binary data results in excessive syscalls that can > degrade performance > ----------------------------------------------------------------------------------------------- > > Key: GUACAMOLE-1776 > URL: https://issues.apache.org/jira/browse/GUACAMOLE-1776 > Project: Guacamole > Issue Type: Improvement > Components: guacamole-server > Reporter: Christopher Speck > Priority: Minor > Fix For: 1.6.0 > > Attachments: vtune_profile.png > > > When sending image/binary data to a socket the data is base64 encoded and > buffered in a way that incurs an excessive number of system calls which can > degrade performance. > > This occurs in {{socket.c}} where {{guac_socket_write_base64}} ends up > calling {{guac_socket_write}} in a tight loop, once for every 3 bytes being > encoded. The system calls this incurs are: > * {{clock_gettime}} via {{guac_timestamp_current}} > * {{{}pthread_mutex_rdlock{}}}/{{{}unlock{}}} via > {{guac_socket_fd_write_handler}} > Attached an image of VTune profiling which shows that very little time is > spent in guac_socket_fd_write_buffered but a lot of time is spent in the > syscalls outlined. > > Introducing a buffer(~1kb) to append data being encoded prior to writing to > the socket results in a performance increase, reducing the time spent on the > syscalls. For relative comparison in our test we started with 13fps and by > introducing the buffer saw an increase to 23fps. -- This message was sent by Atlassian Jira (v8.20.10#820010)