From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 2ED8C2834D for ; Tue, 16 Oct 2018 14:35:18 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9AeSdbsHvwxq for ; Tue, 16 Oct 2018 14:35:18 -0400 (EDT) Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E133E1FC28 for ; Tue, 16 Oct 2018 14:35:17 -0400 (EDT) Date: Tue, 16 Oct 2018 21:35:16 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v2] iproto: introduce a proxy module. Message-ID: <20181016183516.GD5454@chai> References: <20181002180554.1142-1-sergepetrenko@tarantool.org> <20181008104454.k7mj7sb4vhlrgbwa@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181008104454.k7mj7sb4vhlrgbwa@esperanza> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Serge Petrenko * Vladimir Davydov [18/10/08 13:54]: > On Tue, Oct 02, 2018 at 09:05:54PM +0300, Serge Petrenko wrote: > > By default, upon new client connection, all requests from the client are > > forwarded through "guest" connection. Upon recieving an AUTH request, > > proxy processes it on a local instance (this can be done, since proxy is > > being run on one of the cluster instances and has access to user data). > > If auth is successful, new client requests are forwarded through > > corresponding user connection, otherwise, proxy keeps forwarding request > > through guest connection. > > Before diving in the code, I'd like to inquire why you think that a > proxy should forward all user connections with the same credentials > through a single connection to the master. AFAIU this complicates the > implementation quite a bit and may negatively affect performance as > this design implies joggling with sync sequences. > > What if the user deliberately created several connections so as to > avoid throttling certain transactions on hitting the network buffer > limit? I don't think that it's right to push all requests through > the same queue then. It's a good question and we need to bench it. Generally using fewer sockets to marshal requests is cheaper on the server side, since it has to perform fewer syscalls to read data from network. But it depends on the actual load. For example, if all your clients are already multiplexing requests, you're simply performing useless work. But if your typical client is "simple,stupid", e.g. request/response style, then you're saving quite a bit of server CPU time. This can be easily seen in a nosqlbench test. I'd say a typical client is simple, stupid, so multiplexing for it is useful. If you want to be real smart, you could turn multiplexing on/off depending on request/response rate (turn it off for highly loaded connections). But that's an optimization, as a general rule the proxy has to do multiplexing. -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov