<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="224989" data-post-id="224989">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dlesl" data-post="11" data-topic="41425">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dlesl/48/23695_2.png" class="avatar"> dlesl:</div>
<blockquote>
<p>It’s a <a href="https://erlang.org/doc/man/erl_nif.html#proc_indep_env" rel="nofollow">process-independent environment</a>, essentially a way to store erlang terms between NIF calls.</p>
</blockquote>
</aside>
<p>Super glaring omission from my side but then again I’ve probably worked no more than 12-15h on my library in total, including research. Still, embarrassing omission for sure. <img src="https://forum.elixirforum.com/images/emoji/apple/man_facepalming.png?v=15" title=":man_facepalming:" class="emoji" alt=":man_facepalming:" loading="lazy" width="20" height="20"></p>
<p>This looks like a perfect place to store prepared statements cache, for example. Nice.</p>
<aside class="quote no-group" data-username="dlesl" data-post="11" data-topic="41425">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dlesl/48/23695_2.png" class="avatar"> dlesl:</div>
<blockquote>
<p>But maybe what you meant is you don’t want to discover you’ve consumed more than 1 ms worth of CPU time by the time you get to calling <code>enif_consume_timeslice</code>?</p>
</blockquote>
</aside>
<p>Yes, exactly. I want 1ms to be a complete total maximum runtime of all SQL execution functions no matter what. (I don’t mind opening/closing the DB or setting some options to take more than 1ms because those are 0.1% of the function calls.) To that end… <img src="https://forum.elixirforum.com/images/emoji/apple/point_down.png?v=15" title=":point_down:" class="emoji" alt=":point_down:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="dlesl" data-post="11" data-topic="41425">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dlesl/48/23695_2.png" class="avatar"> dlesl:</div>
<blockquote>
<p>What about doing the query on another thread and returning the result as a message? Depending on how many connections you expect the user to want to have open, you could spawn a thread per connection.</p>
</blockquote>
</aside>
<p>No problem with that at all indeed. I was just over-fixating on having a synchronous API that might do all sorts of dirty trickery underneath so as to never clog the BEAM VM – having several seconds of response time when querying big SQLite3 public DBs isn’t unheard of. I’ve queried various census databases (1TB+) and there were some simple JOINs with 2-3 filters that took at least 4s. I don’t think any user of the library would mind that at all – but they would mind if the BEAM VM’s guarantees were broken due to it.</p>
<p>So I’ll follow closely the implementation of <code>enif_schedule_nif</code> into Rustler or, depending on timing, might just reach for the guts of SQLite3 and make it periodically yield to internal Rust functions of mine which track progress and assemble the response.</p>
<p>So again, I over-fixated on having a sync API but adding async API has been super tempting from the very beginning! <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
<hr>
<p>I am seeing that Rustler PR not being active for the last PR but right now I don’t have all the necessary Rust qualifications to contribute (sigh).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="224989" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/erqwest-a-fast-and-correct-http-client-based-on-reqwest/41425/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-224989" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="224989"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="287514" data-post-id="287514">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="theodore" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  theodore
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for the library! I was dealing with some memory issues with HTTPoison and erqwest eliminated the problem. There seem to be no increase in memory when performing get requests in my Phoenix application. Interesting enough, I compared it with Finch and found them both to be the same speed, but Finch consumed more memory, so I ended up using erqwest.</p>
<p>One question: do you think it’s okay to make one default erqwest client to use amongst all my LiveView processes?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="287514" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/erqwest-a-fast-and-correct-http-client-based-on-reqwest/41425/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-287514" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="287514"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="288908" data-post-id="288908">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dlesl" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dlesl/120/23695_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dlesl
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Glad to hear that it’s performing well! Yes it’s best to share a single client, it’s safe to use from multiple processes simultaneously. Internally a client holds a reqwest <a href="https://docs.rs/reqwest/latest/reqwest/struct.Client.html" rel="noopener nofollow ugc">Client</a>, and the docs there recommend creating one and reusing it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="288908" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/erqwest-a-fast-and-correct-http-client-based-on-reqwest/41425/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-288908" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="288908"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="288941" data-post-id="288941">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="theodore" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  theodore
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Awesome man, thanks!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="288941" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/erqwest-a-fast-and-correct-http-client-based-on-reqwest/41425/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-288941" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="288941"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>