Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJScS-0006Dg-I6 for qemu-devel@nongnu.org; Wed, 24 Jun 2009 09:34:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJScN-00069I-Vj for qemu-devel@nongnu.org; Wed, 24 Jun 2009 09:34:32 -0400 Received: from [199.232.76.173] (port=47797 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJScN-000698-GV for qemu-devel@nongnu.org; Wed, 24 Jun 2009 09:34:27 -0400 Received: from smtp.eu.citrix.com ([62.200.22.115]:26804) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJScN-0000fY-0g for qemu-devel@nongnu.org; Wed, 24 Jun 2009 09:34:27 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-ID: <19010.11102.28799.518165@mariner.uk.xensource.com> Date: Wed, 24 Jun 2009 14:34:22 +0100 Subject: Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file In-Reply-To: <4A42200C.6060600@codemonkey.ws> References: <4A40FB11.8090100@redhat.com> <4A40FB26.2040702@us.ibm.com> <4A40FD1A.1040303@redhat.com> <4A40FE31.2010007@us.ibm.com> <4A40FFB0.2070905@redhat.com> <4A411FC5.7050701@us.ibm.com> <4A412339.5000109@redhat.com> <4A412659.1080803@us.ibm.com> <20090623220204.GA5612@snarc.org> <4A415C30.7030301@us.ibm.com> <20090624010108.GA6537@snarc.org> <4A42200C.6060600@codemonkey.ws> From: Ian Jackson List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: ehabkost@redhat.com, jan.kiszka@siemens.com, dlaor@redhat.com, qemu-devel@nongnu.org, Luiz Capitulino , Avi Kivity , Vincent Hanquez Anthony Liguori writes ("Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file"): > I'm not at all convinced that we should switch to an RPC mechanism in > the first place. Perhaps someone could summarize the advantages of > doing this because right now, I don't see many. I'm keen on RPC-like systems. The main advantage is that you don't have to invent and write a whole lot of marshalling and parsing code; the RPC system will provide all that for you. The more sophisticated systems deal with message transport as well, so you don't need to mess about with sockets either. Parsers and formatters are one of the most tedious bits of code to write and they are also critical for security, reliability and data transparency. It really doesn't make sense to roll your own for any nontrivial problem. If you pick the right RPC system you can get, entirely for free (well, entirely piggybacking on other people's work) compact and efficiently parseable binary wire formats. Debugging trace output facilities, which produce in nice human readable formats, are often provided as a standard feature for no added effort. Bindings for a wide variety of programming languages can be easily found. If you pick a bus- or broker-based system (dbus, XDR, corba even) you get discovery and rendezvous for free too. Many systems have builtin facilities for cross-version compatibility, of varying sophistication. I would go further and say that we should use an RPC system with a machine-readable IDL (Interface Description Language). A formal IDL provides an number of very significant advantages. If you use an IDL, the protocol is documented not primarily in a human-only-readable text file, but primarily in the IDL, which means that the documentation cannot get out of date. Introspection and debugging features are easier to provide because all of the programs have actual knowledge of the message format and structure. The wire formats can be much more compact and efficient, because they do not need to tag every value with its type and format - the receiving end knows what the format is supposed to be and can get straight to unpicking it. You can have an argument about which specific RPC mechanism to use, but it's an embarrassment of riches compared to designing and writing your own textual protocol, particularly if that protocol needs to be quite complex and asynchronous. I think dbus would be a good choice, but even XML-RPC (which, frankly, is flabby, overcomplex, slow, hard to read, etc.), JSON (which doesn't have an IDL that can even do checking), and ASN.1/DER/BER (which is a complexity nightmare) would be an improvement over no automatic parsing machinery. > One reason to choose an RPC is based on the adoption of it. You want to > use something that has a vibrant community with well established client > libraries to make writing clients as easy as possible. Without an > active jsonrpc C library, it's hard to argue that jsonrpc has that. > xml-rpc certainly does. Yes. Ian.