# Constant CPU cost algorithm

**URL:** <https://forum.elixirforum.com/t/constant-cpu-cost-algorithm/36466>\
**Category:** Questions\
**Tags:** worker-pools, crypto, cpu\
**Created:** [December 28, 2020, 1:32am UTC](https://forum.elixirforum.com/t/constant-cpu-cost-algorithm/36466 "2020-12-28T01:32:29Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![victorolinasc](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/victorolinasc/32/10667_2.png) [@victorolinasc](https://forum.elixirforum.com/u/victorolinasc)\
**Post date:** [December 28, 2020, 5:02pm UTC](https://forum.elixirforum.com/t/constant-cpu-cost-algorithm/36466/8 "2020-12-28T17:02:54Z")

</div>

Using an external queue system (be it RabbitMQ, Oban, Kafka or whatever) makes it a lot harder to have synchronous responses to reply to the end user. I could pass the PID of the request as an arg and send a reply later and so on or persist the result somewhere and check it later on, but I think this is a bit overwhelming and it doesn’t consider the environment I am running the requests as the meter to accept/deny more work.

What I want is closer to rate-limiting but should consider CPU and not requests per minute or something like that. I think I will try a custom rule from `plug_attack`…

---

_[View the full topic](https://forum.elixirforum.com/t/constant-cpu-cost-algorithm/36466)._
