<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>I did some benchmarks for the client/server based sword data
      transfer.<br>
      <br>
      This is how long my function for requesting the chapter text takes
      in different scenarios.<br>
    </p>
    <p>The node-sword-web-api based server runs on an AWS VM. The client
      (Ezra Bible App) on my Linux laptop.<br>
    </p>
    <p>The scenarios have been simulated using the throttle tool (see
      <a class="moz-txt-link-freetext" href="https://github.com/sitespeedio/throttle">https://github.com/sitespeedio/throttle</a>).</p>
    <table width="720" height="326" cellspacing="2" cellpadding="2"
      border="1">
      <tbody>
        <tr>
          <td valign="top"><b>Scenario</b><br>
          </td>
          <td valign="top"><b>Performance for loading John 3 (NASB)</b><br>
          </td>
        </tr>
        <tr>
          <td valign="top">2g: up:256 down:280 rtt:400<br>
          </td>
          <td valign="top">4901ms<br>
          </td>
        </tr>
        <tr>
          <td valign="top">2g: up:256 down:280 rtt:400 <br>
            (http compression enabled on server side)<br>
          </td>
          <td valign="top">3677ms<br>
          </td>
        </tr>
        <tr>
          <td valign="top">3g: up:768 down:1600 rtt:150</td>
          <td valign="top">1820ms</td>
        </tr>
        <tr>
          <td valign="top">3g: up:768 down:1600 rtt:150<br>
            (http compression enabled on server side)<br>
          </td>
          <td valign="top">1501ms<br>
          </td>
        </tr>
        <tr>
          <td valign="top">Home DSL connection without throttling<br>
          </td>
          <td valign="top">320ms<br>
          </td>
        </tr>
        <tr>
          <td valign="top">Home DSL connection without throttling<br>
            (http compression enabled on server side)<br>
          </td>
          <td valign="top">302ms<br>
          </td>
        </tr>
      </tbody>
    </table>
    <p>Best regards,<br>
      Tobias</p>
    <br>
    <div class="moz-cite-prefix">On 8/11/24 10:34 PM, Tobias Klein
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:19143262110.2855.8615574ea28fbd6f84c146d5b0849810@tklein.info">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div dir="auto">Hi Fred!</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I suppose the redundancy is a general issue of
          json or xml when having long lists of elements.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Http servers and clients support gzip
          compression (and other more modern algorithms). That's
          something I could check to optimize the data amounts that are
          sent when making requests on this web-based API.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Best regards, </div>
        <div dir="auto">Tobias</div>
        <div dir="auto"><br>
        </div>
        <div id="aqm-original" style="color: black;">
          <!-- body start -->
          <div class="aqm-original-body">
            <div style="color: black;">
              <p style="color: black; font-size: 10pt; font-family:
                sans-serif; margin: 8pt 0;">Am 11. August 2024 21:03:26
                schrieb Fred <a class="moz-txt-link-rfc2396E" href="mailto:fred.fredex@gmail.com"><fred.fredex@gmail.com></a>:</p>
              <blockquote type="cite" class="gmail_quote" style="margin:
                0 0 0 0.75ex; border-left: 1px solid #808080;
                padding-left: 0.75ex;">
                <div dir="ltr">
                  <div>I'm just a lurker here, but... even though I've
                    dabbled in json, I gotta say that is  horribly
                    verbose! I'd be willing to bet oh, say, fifty cents
                    that a slow link would perform poorly. since (as I
                    understand it) it is the remote server sending all
                    that, that there'd be no way to filter out all the
                    redundant json on each verse, which I'd expect to
                    make it much more slow-link-friendly.<br>
                  </div>
                  <div><br>
                  </div>
                  <div>Fred<br>
                  </div>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Sun, Aug 11, 2024
                    at 1:56 AM Aaron Rainbolt <<a
                      href="mailto:arraybolt3@gmail.com"
                      moz-do-not-send="true">arraybolt3@gmail.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">Haven't been
                    replying since I'm busy, but this is awesome. Thank
                    you<br>
                    for actually giving my idea a shot! I'll have to
                    experiment with it :)<br>
                    <br>
                    On Sun, 4 Aug 2024 21:00:24 +0200<br>
                    Tobias Klein <<a
                      href="mailto:contact@tklein.info" target="_blank"
                      moz-do-not-send="true">contact@tklein.info</a>>
                    wrote:<br>
                    <br>
                    > Hi Aaron & all,<br>
                    > <br>
                    > so, this whole thread about SWORD over network
                    inspired me to play<br>
                    > with existing technology a bit.<br>
                    > The goal: Run Ezra Bible App accessing the
                    SWORD modules via a remote <br>
                    > server instead of locally.<br>
                    > <br>
                    > I implemented a small web service API based on
                    node-sword-interface<br>
                    > and expressjs.<br>
                    > See <a
                      href="https://github.com/ezra-bible-app/ezra-bible-app-server"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://github.com/ezra-bible-app/ezra-bible-app-server</a><br>
                    > <br>
                    > Example - <br>
                    > <a
href="https://github.com/ezra-bible-app/ezra-bible-app-server/blob/main/routes/module.js"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://github.com/ezra-bible-app/ezra-bible-app-server/blob/main/routes/module.js</a><br>
                    > <br>
                    > // Delivers the text of a chapter via the url <br>
                    >
/module/<moduleCode>/chaptertext/<bookCode>/<chapterNumber><br>
                    > <br>
                    >
                    router.get('/:moduleCode/chaptertext/:bookCode/:chapter',
                    (req, res)<br>
                    > => { const moduleCode =
                    req.params.moduleCode;<br>
                    >    const bookCode = req.params.bookCode;<br>
                    >    const chapter =
                    parseInt(req.params.chapter);<br>
                    > <br>
                    >    const chapterText =
                    nsi.getChapterText(moduleCode, bookCode,<br>
                    > chapter); res.json(chapterText);<br>
                    > });<br>
                    > <br>
                    > See here for example server deployed on some
                    AWS machine I quickly<br>
                    > set up. The following URL delivers the KJV text
                    of John 5 as JSON.<br>
                    > <a
href="http://ec2-13-48-148-192.eu-north-1.compute.amazonaws.com/module/KJV/chaptertext/John/5"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">http://ec2-13-48-148-192.eu-north-1.compute.amazonaws.com/module/KJV/chaptertext/John/5</a><br>
                    > <br>
                    > Then I made some adjustments in the backend of
                    Ezra Bible App, <br>
                    > implementing a "switch" in a few methods that
                    normally access a local <br>
                    > node-sword-interface / SWORD installation.<br>
                    > <br>
                    > The respective example section in the Ezra
                    Bible App backend looks<br>
                    > like this:<br>
                    > <a
href="https://github.com/ezra-bible-app/ezra-bible-app/blob/web-api/app/backend/ipc/ipc_nsi_handler.js#L243"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://github.com/ezra-bible-app/ezra-bible-app/blob/web-api/app/backend/ipc/ipc_nsi_handler.js#L243</a><br>
                    > <br>
                    >      this._ipcMain.add('nsi_getChapterText',
                    async (moduleCode, <br>
                    > bookCode, chapter) => {<br>
                    >        if (!this._useWebApi) {<br>
                    >          return
                    this._nsi.getChapterText(moduleCode, bookCode,<br>
                    > chapter); } else {<br>
                    >          return await <br>
                    >
this.getFromWebApi(`/module/${moduleCode}/chaptertext/${bookCode}/${chapter}`);<br>
                    >        }<br>
                    >      });<br>
                    > <br>
                    > Based on the switch useWebApi (currently just a
                    constant) I can<br>
                    > switch between the "local version" and the
                    "remote version".<br>
                    > The interface is compatible, because both the
                    local version and the <br>
                    > remote version pull data from
                    node-sword-interface and that already <br>
                    > returns JSON as of today.<br>
                    > <br>
                    > I ended up with a test version of Ezra Bible
                    App that would load<br>
                    > module lists and offer the regular browsing
                    capabilities as the<br>
                    > normal "offline" variant.<br>
                    > The performance in the UI for regular Bible
                    browsing is nearly the<br>
                    > same.<br>
                    > <br>
                    > The use case that I see is to install a bunch
                    of popular modules on<br>
                    > the server side for different languages and
                    offer these to the user<br>
                    > based on quick "online access" right after
                    installing the app.<br>
                    > <br>
                    > I am also interested how this behaves when the
                    internet connection is <br>
                    > slower. I'll report some findings once I have
                    them. It should be easy<br>
                    > to simulate that now based on the developer
                    tools built into Electron.<br>
                    > <br>
                    > Right now this is an experiment. I'll explore a
                    bit more and if this <br>
                    > turns out useful, I may think about integrating
                    this into Ezra.<br>
                    > <br>
                    > Best regards,<br>
                    > Tobias<br>
                    > <br>
                    <br>
                    _______________________________________________<br>
                    sword-devel mailing list: <a
                      href="mailto:sword-devel@crosswire.org"
                      target="_blank" moz-do-not-send="true">sword-devel@crosswire.org</a><br>
                    <a
                      href="http://crosswire.org/mailman/listinfo/sword-devel"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a><br>
                    Instructions to unsubscribe/change your settings at
                    above page<br>
                  </blockquote>
                </div>
                <div>_______________________________________________</div>
                <div>sword-devel mailing list: <a class="aqm-autolink
                    aqm-autowrap"
                    href="mailto:sword-devel%40crosswire.org"
                    moz-do-not-send="true">sword-devel@crosswire.org</a></div>
                <div><a class="aqm-autolink aqm-autowrap"
                    href="http://crosswire.org/mailman/listinfo/sword-devel"
                    moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a></div>
                <div>Instructions to unsubscribe/change your settings at
                  above page</div>
                <div><br>
                </div>
              </blockquote>
            </div>
          </div>
          <!-- body end -->
        </div>
        <div dir="auto"><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page
</pre>
    </blockquote>
  </body>
</html>