TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Elixir: Practical Concurrency Cookbook

111 pointsby akbarnamaalmost 4 years ago

4 comments

manusachialmost 4 years ago
&gt; One of the strengths of GenServers is that they allow us to spin one up per user very easily, so they don&#x27;t become a bottleneck where the Agent does.<p>Agent is a special case of GenServer[1]. With the same luck we could spin up an agent per user.<p>[1] [Agent.start_link&#x2F;2](<a href="https:&#x2F;&#x2F;github.com&#x2F;elixir-lang&#x2F;elixir&#x2F;blob&#x2F;9137fd1cb2368bb1bc3a9c590440dffc9f5fed62&#x2F;lib&#x2F;elixir&#x2F;lib&#x2F;agent.ex#L271" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;elixir-lang&#x2F;elixir&#x2F;blob&#x2F;9137fd1cb2368bb1b...</a>)
tylerpachalalmost 4 years ago
In addition to what the offer recommended in the &quot;Scheduling work&quot; section, using the `:timer.send_interval()` can be useful if you want to do something every X seconds, instead of every X + Y seconds, where Y is the time it takes to process the &quot;work&quot; message.<p>Also I prefer to use `handle_continue` instead of `schedule_work()` style (which in a lot of cases pre-date the introduction of `handle_continue`).
sandwichinvestalmost 4 years ago
Having reliable scheduling in the language itself seems like it would simplify a ton of software that&#x27;s currently reliant on a lot of message queueing and cron duct tape. Running BEAM in production still scares me, but that&#x27;s one reason to conquer the fear.
评论 #27952755 未加载
评论 #27953439 未加载
atonsealmost 4 years ago
Regarding caching, after years of not using any, we finally ended up using nebulex (with the in-memory cache) and it’s been excellent.<p>The ability to add cache annotations to functions feels really clean.<p>There’s also the ability to have cluster wide state but we haven’t set that up yet. We will soon.
评论 #27953121 未加载