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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="NinekoTheCat" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/NinekoTheCat/120/32175_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  NinekoTheCat
                    <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>I meant my app is calling an external entity</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304161" 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/why-isnt-the-actor-model-used-in-the-wild/58930/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-304161" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304161"
                     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 #21"></div>
  </section>
</div>
    <div class="postbit" id="304162" data-post-id="304162">
  <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">
								<p>That’s up to you. You can choose to spawn a new process to do it so as not to block your current process, or do it inside the current process.</p>
<p>That really depends on your app. You are asking stuff that’s related to the business’ requirements.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304162" 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/why-isnt-the-actor-model-used-in-the-wild/58930/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-304162" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304162"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="304164" data-post-id="304164">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="NinekoTheCat" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/NinekoTheCat/120/32175_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  NinekoTheCat
                    <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>So it just depends on if it’ll take enough time to concider it being a separate process? Like a request that takes 2 ms is fine but one which you’d be stuck waiting for for like 2s is not?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304164" 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/why-isnt-the-actor-model-used-in-the-wild/58930/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-304164" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304164"
                     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 #23"></div>
  </section>
</div>
    <div class="postbit" id="304166" data-post-id="304166">
  <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">
								<p>Well, roughly – yes, that’s one factor.</p>
<p>But there’s more to it. So imagine your app is for example about reserving hours to doctors. And in your controller you have to consult a 3rd party API (for example Microsoft Calendar).</p>
<ul>
<li>If you want to give people immediate confirmation or rejection, you do the 3rd party API call (a network request) inside your controller function without spawning a process, so your customers will have to wait in the browser until that request completes.</li>
<li>If you opt for customers to never wait you will spawn this 3rd party network API call in a new process and immediately return something to the customers like “We have requested reservation of the hours of this doctor. You should receive an email within a few minutes telling you if the hours are free.”</li>
</ul>
<p>As you can see, this is not about the technical capabilities, this is about what the business wants.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304166" data-batch-url="/posts/batch_likers">
                        5
                      </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/why-isnt-the-actor-model-used-in-the-wild/58930/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-304166" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304166"
                     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 #24"></div>
  </section>
</div>
    <div class="postbit" id="304169" data-post-id="304169">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I just took a better look at your akkoma link.  Everything from line 62-82 will spawn (at least one) process.  The actual spawing is done on 98.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304169" 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/why-isnt-the-actor-model-used-in-the-wild/58930/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-304169" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304169"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="304171" data-post-id="304171">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="NinekoTheCat" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/NinekoTheCat/120/32175_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  NinekoTheCat
                    <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>So it’s not technical, and it’s not about code organisation</p>
<p>It’s about whenever you want to defer something or not?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304171" 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/why-isnt-the-actor-model-used-in-the-wild/58930/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-304171" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304171"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="304173" data-post-id="304173">
  <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">
								<p>You are making a very classic mistake here – you are trying to find a simple formula.</p>
<p>There is no simple formula though.</p>
<p>The actor model (Erlang processes) is about being able to model runtime entities. Which entities, how many, and when are they spawned depends on your business requirements.</p>
<p>Actors are just one more tool in your belt.</p>
<p>This article might help a little bit: <a href="https://www.theerlangelist.com/article/spawn_or_not" class="inline-onebox" rel="noopener nofollow ugc">The Erlangelist - To spawn, or not to spawn?</a></p>
<p>But again, don’t expect a simple formula.</p>
<aside class="quote no-group" data-username="NinekoTheCat" data-post="27" data-topic="58930">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ninekothecat/48/32175_2.png" class="avatar"> NinekoTheCat:</div>
<blockquote>
<p>It’s about whenever you want to defer something or not?</p>
</blockquote>
</aside>
<p>That’s part of the entire answer – and here the partial answer is “yes”.</p>
<p>But there’s also the aspect of “I want to control access to a resource” (you already mentioned locking) and “I want to make sure this entity receives messages only one by one, sequentially” (what <code>GenServer</code>s do).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304173" data-batch-url="/posts/batch_likers">
                        8
                      </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/why-isnt-the-actor-model-used-in-the-wild/58930/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-304173" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304173"
                     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 #27"></div>
  </section>
</div>
    <div class="postbit" id="304902" data-post-id="304902">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I offer some simple real-world decision-making about why I choose to spawn an actor in a particular case and why I don’t for the most part.</p>
<p>In almost every case in the Phoenix model, the logic of the framework flows where you handle the business logic of a user’s web connection from start to finish – when data is returned to the user: HTML, JSON, you know, <em>data</em>.</p>
<p>In one case for an actor, I’ve built a widget where the user uploads an image and interacts with the image many times in a session. Behind the scenes, the image is uploaded as an agent with its own logic and rules, and for the length of that user’s session with the image, the connection is kept hot, the UI stays zippy, and the agent cleans itself and the image up after a set amount of idle time. In this case, this all makes sense – I have reasonable fallbacks to reconnect the user to their image in case of a crash, and the system keeps its room nice and tidy without any extra effort from a supervisor or a cron job.</p>
<p>In another case, the admin user has a tool where they generate a large number of data for a wide swath of users, and then they have the option to send an email to interested parties – sometimes many hundreds of people. My sendmail service likes a small pause between messages when sending from the API, so I lock the UI and provide loading bar feedback while the first round of processing takes place, then I spawn the sending of the email to another process so it can run in the background at its leisure with the API-prescribed sending delay, freeing up the UI for other work.</p>
<p>Like <a href="/u/dimitarvp" rel="nofollow">dimitarvp</a> explains, this is a “How long is a piece of string” kind of question. There’s no single answer that will apply in all cases. It depends on you and your users’ needs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="304902" data-batch-url="/posts/batch_likers">
                        2
                      </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/why-isnt-the-actor-model-used-in-the-wild/58930/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-304902" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="304902"
                     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>