communication_models.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Communication models &#8212; Modelverse 0.4.0 documentation</title>
  7. <link rel="stylesheet" href="_static/classic.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '0.4.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/underscore.js"></script>
  20. <script type="text/javascript" src="_static/doctools.js"></script>
  21. <link rel="top" title="Modelverse 0.4.0 documentation" href="index.html" />
  22. <link rel="prev" title="Internal workings" href="internal.html" />
  23. </head>
  24. <body role="document">
  25. <div class="related" role="navigation" aria-label="related navigation">
  26. <h3>Navigation</h3>
  27. <ul>
  28. <li class="right" style="margin-right: 10px">
  29. <a href="genindex.html" title="General Index"
  30. accesskey="I">index</a></li>
  31. <li class="right" >
  32. <a href="internal.html" title="Internal workings"
  33. accesskey="P">previous</a> |</li>
  34. <li class="nav-item nav-item-0"><a href="index.html">Modelverse 0.4.0 documentation</a> &#187;</li>
  35. </ul>
  36. </div>
  37. <div class="document">
  38. <div class="documentwrapper">
  39. <div class="bodywrapper">
  40. <div class="body" role="main">
  41. <div class="section" id="communication-models">
  42. <h1>Communication models<a class="headerlink" href="#communication-models" title="Permalink to this headline">¶</a></h1>
  43. <p>The network communication in the Modelverse builds on top of the raw socket implementation of Python.
  44. Whereas we use normal HTTP requests, we explicitly opted not to use these libraries.
  45. Many of these libraries hide important implementation details, such as how successive requests are handled (sequential, threaded, ...), whether or not to keep connections open and reuse them, which HTTP version to implement, and so on.
  46. As the HTTP protocol is a simple protocol, we reimplemented it completely in SCCD (StateCharts and Class Diagrams).</p>
  47. <p>There are two network components: a server in the MvS, and a server and client in the MvK.</p>
  48. <div class="section" id="mvs-server">
  49. <h2>MvS server<a class="headerlink" href="#mvs-server" title="Permalink to this headline">¶</a></h2>
  50. <img alt="_images/mvs_server.svg" src="_images/mvs_server.svg" /><p>The MvS server mainly just waits for incoming HTTP requests and presents the message to the MvS interface itself.
  51. Each part of the processing happens in a seperate orthogonal component, but in all cases, processing happens sequentially, and buffers are implemented in between each layer.
  52. This way, we can be certain that invocations on the MvS will always happen sequentially.</p>
  53. <p>The statechart consists of two parts.</p>
  54. <p>The topmost part is the HTTP server itself, which waits from messages from the sockets.
  55. When it starts up, a socket is created that listens to incoming connections.
  56. Messages from the socket are then processed.
  57. Apart from setting up the sockets, this component serializes all requests that get sent to the MvS: events are placed in a queue, and are only executed on the MvS when it has finished processing the previous request.</p>
  58. <p>The bottommost part is the socket server, which wraps around the socket and keeps fetching from the socket until it gets a complete HTTP request.
  59. The HTTP request is then split from the other data on the socket, and forwarded as a single request to the HTTP server.
  60. We explicitly need to check and split HTTP requests, as our protocol allows users to bundle multiple HTTP requests simultaneously.
  61. These requests will just come one after the other, so the socket buffer might contain two messages at the same time, or even fragments of a second request.
  62. A message is forwarded as soon as it is completely reconstructed.</p>
  63. </div>
  64. <div class="section" id="mvk-server">
  65. <h2>MvK server<a class="headerlink" href="#mvk-server" title="Permalink to this headline">¶</a></h2>
  66. <img alt="_images/mvk_server.svg" src="_images/mvk_server.svg" /><div class="admonition note">
  67. <p class="first admonition-title">Note</p>
  68. <p class="last">This figure shows the intended model, not the optimized model.
  69. For performance reasons, many of these parts are merged together in the <em>run_local_modelverse.py</em> script.
  70. As a result, it only implements the <em>MvKController</em>, <em>Server</em>, and <em>Socket</em> classes.
  71. A more elaborate statechart implementation also exists, which does implements this whole figure.</p>
  72. </div>
  73. <p>The MvK server again has a HTTP server, similar to the one of the MvS, but also has a HTTP client.</p>
  74. <p>Apart from this, there is also a</p>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  81. <div class="sphinxsidebarwrapper">
  82. <h3><a href="index.html">Table Of Contents</a></h3>
  83. <ul>
  84. <li><a class="reference internal" href="#">Communication models</a><ul>
  85. <li><a class="reference internal" href="#mvs-server">MvS server</a></li>
  86. <li><a class="reference internal" href="#mvk-server">MvK server</a></li>
  87. </ul>
  88. </li>
  89. </ul>
  90. <h4>Previous topic</h4>
  91. <p class="topless"><a href="internal.html"
  92. title="previous chapter">Internal workings</a></p>
  93. <div role="note" aria-label="source link">
  94. <h3>This Page</h3>
  95. <ul class="this-page-menu">
  96. <li><a href="_sources/communication_models.txt"
  97. rel="nofollow">Show Source</a></li>
  98. </ul>
  99. </div>
  100. <div id="searchbox" style="display: none" role="search">
  101. <h3>Quick search</h3>
  102. <form class="search" action="search.html" method="get">
  103. <div><input type="text" name="q" /></div>
  104. <div><input type="submit" value="Go" /></div>
  105. <input type="hidden" name="check_keywords" value="yes" />
  106. <input type="hidden" name="area" value="default" />
  107. </form>
  108. </div>
  109. <script type="text/javascript">$('#searchbox').show(0);</script>
  110. </div>
  111. </div>
  112. <div class="clearer"></div>
  113. </div>
  114. <div class="related" role="navigation" aria-label="related navigation">
  115. <h3>Navigation</h3>
  116. <ul>
  117. <li class="right" style="margin-right: 10px">
  118. <a href="genindex.html" title="General Index"
  119. >index</a></li>
  120. <li class="right" >
  121. <a href="internal.html" title="Internal workings"
  122. >previous</a> |</li>
  123. <li class="nav-item nav-item-0"><a href="index.html">Modelverse 0.4.0 documentation</a> &#187;</li>
  124. </ul>
  125. </div>
  126. <div class="footer" role="contentinfo">
  127. &#169; Copyright 2016, Yentl Van Tendeloo.
  128. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.6.
  129. </div>
  130. </body>
  131. </html>