<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">> The most obvious thing is to depend on something like Thrift, grpc, etc, but these aren't trivial dependencies to take on.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I would recommend against using Apache Thrift unless you are able to recruit a larger community for that project.  I am on the project management committee of Apache Thrift, and I do not feel that it is organizationally prepared to handle
 a client like LLVM.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Note that I am specifically referring to Apache Thrift.  I take no stance on fbthrift, or any of the other Thrift branches or forks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> <b>On Behalf Of
</b>Chris Bieneman via llvm-dev<br>
<b>Sent:</b> Friday, December 13, 2019 1:12 PM<br>
<b>To:</b> Sam McCall <sammccall@google.com><br>
<b>Cc:</b> LLVM Dev <llvm-dev@lists.llvm.org>; via clangd-dev <clangd-dev@lists.llvm.org><br>
<b>Subject:</b> [EXTERNAL] Re: [llvm-dev] Network RPCs in LLVM projects<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Dec 12, 2019, at 5:58 AM, Sam McCall via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Short version: clangd would like to be able to build a client+server that can make RPCs across the internet. An RPC system isn't a trivial dependency and rolling our own from scratch isn't appealing.<o:p></o:p></p>
<div>
<p class="MsoNormal">Have other projects had a need for this? Any advice on how to approach such dependencies?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Longer: clangd (a language server, like an IDE backend) builds an index of the project you're working on in order to answer queries (go to definition, code completion...). This takes *lots* of CPU-time to build, and RAM to serve.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">For large codebases with many developers, <a href="https://urldefense.com/v3/__https:/llvm.discourse.group/t/sharing-indexes-for-multiple-users/202__;!!FbZ0ZwI3Qg!-T3MdhMfM0mtXvun8MGCobbUPx90529XRayAMAG-krixjXbjuvXx6tRyCt6K$">
sharing an index across users</a> is a better approach - you spend the CPU in one place, you spend the RAM in a few places, and an RPC is fast enough even for code completion. We have experience with this approach inside Google.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">We'd like to build this index server upstream (just a shell around clangd's current index code) and put the client in clangd. For open-source projects, I imagine the server being publicly accessible over the internet.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This means we care about<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - latency (this is interactive, every 10ms counts)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - security<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - proxy traversal, probably<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - sensible behavior under load<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> - auth is probably nice-to-have<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I don't think this is something we want to build from scratch, I hear portable networking is hard :-)<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It really isn't that bad. Just as a note, LLDB does have portable socket communication already, so it could be a refactor and reuse exercise rather than building from scratch.<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal">The most obvious thing is to depend on something like Thrift, grpc, etc, but these aren't trivial dependencies to take on. They could probably be structured as an optional CMake dependency, which we'd want to ask distributors to enable.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This is possible, but adding large and non-standard external dependencies have significant drawbacks for distribution.<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Have other projects had anything like these requirements? Any solutions, or desire to use such infrastructure? I saw some RPC layer in ORC, but it seems mostly abstract/FD-based IPC.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The ORC RPC layer in-tree runs over sockets, but I've implemented it to run over XPC (a Darwin low-latency IPC mechanism). It is actually a really useful abstraction over true remote procedure calls. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-Chris<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="https://urldefense.com/v3/__https:/lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev__;!!FbZ0ZwI3Qg!-T3MdhMfM0mtXvun8MGCobbUPx90529XRayAMAG-krixjXbjuvXx6pjHy4wa$">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>