Comments (20)
can we just make this a test and then assert some anticipated performance time?
from exq.
Yeah that would be a great way to go about it. As part of #21, if we can make a test and assert performance, it would be awesome.
from exq.
Not sure how fast Timex is either, i use it to handle / parse dates. Could be a potential bottleneck?
from exq.
Not sure about Timex, did not look at that one. Even so, if we get the stats recorded async / separate process that shouldn't be an issue, since it would probably be on a different core.
from exq.
Yep yep, sounds like a plan.
from exq.
About to check in the harness - definitely notice a slowdown, this should help diagnose.
from exq.
If we want to test differences between maps / structs and poison / exjson we could try
http://www.erlang.org/doc/man/timer.html#tc-1
from exq.
OK, see #35. With old branch, it is able to get 5k in about 3 seconds. The current version only gets about 1k messages in 6 seconds. There do appear to be some intermittent failures with the Redis shutdown.
from exq.
the terminate callbacks may be getting backed up when they write to redis. Did you test with commenting out the terminate callback to manager?
from exq.
Should we create a redis connection pool? I feel like a single redis connection may cause blocking behavior
from exq.
Looking at it now, it seems like the first major culprit is the job_json method, with the Poison encoding the struct. Using Poison with Enum vs Struct definitely speeds that up.
I feel like Redis is pretty fast, and handles a large number of instructions / sec. It's definitely worth a try though. The other thing is the JSON parsing - another thing worth trying is having multiple dispatchers once the job is out of Redis. I still need to think of the process model / supervision tree to see what the best thing is - we can take a look at something like pool_boy or another library. I do feel like the stats can safely be put in another process because it is out of band (if we do that, we should captures the timestamp before sending it to the stats worker).
from exq.
is {jid, Poison.Encoder.encode(job, %Job{})}
faster?
i wonder if supplying the struct type would help Poison to figure things out faster.
from exq.
Yeah looks like, this is faster it seems (same as JSEX):
jid = UUID.uuid4
job = Enum.into([{:queue, queue}, {:class, worker}, {:args, args}, {:jid, jid}], HashDict.new)
{jid, Poison.encode!(job)}
from exq.
cool looks good to me.
from exq.
Seems like the other culprit is the decode (3.8 vs 0.8):
json = Poison.decode!(state.job)
job = %Exq.Job{
queue: Dict.get(json, "queue"),
class: Dict.get(json, "class"),
jid: Dict.get(json, "jid"),
error_message: Dict.get(json, "error_message"),
error_class: Dict.get(json, "error_class"),
failed_at: Dict.get(json, "failed_at"),
retry: Dict.get(json, "retry"),
retry_count: Dict.get(json, "retry_count"),
processor: Dict.get(json, "processor"),
args: Dict.get(json, "args"),
finished_at: Dict.get(json, "finished_at"),
enqueued_at: Dict.get(json, "enqueued_at")}
from exq.
And finally... The terminate / sending stats is the final difference. Will see if separating that out will fix it (2.5 vs 4.5 sec).
from exq.
you are doing god's work.
I know we Encode/Decode structs in there.
from exq.
OK I merged #35. There's still a few encode / decode in the stats that I didn't get a chance to fix - I wonder if we can put an encode / decode in the struct.
from exq.
yes! i was gonna recommend that. im adding more code that needs to do this, if we can do that, it would be great.
from exq.
OK, looks like that was moved into #40, closing this one.
from exq.
Related Issues (20)
- Proposal: add middleware hook just before apply(mod, fun, args) in Task started by worker HOT 2
- Can't find running job HOT 1
- How to configure a worker at runtime? HOT 4
- Order of middleware execution HOT 1
- Busy Tab is not working HOT 2
- Busy Tab is not working
- no function clause matching in Exq.Manager.Server.handle_call/3 HOT 2
- `Exq.enqueue_in` doesn't work in `mode: [:enqueuer, :api]` HOT 3
- Exq vs Oban? HOT 1
- Redis 6.0 ACL is supported ? HOT 1
- Dynamic subscription enqueued workers never run HOT 2
- [Question] How do I get job score? HOT 3
- Logging middleware doesn't give support for enqueueing logs HOT 5
- expected :timeout to be an integer of :infinity, got: nil HOT 5
- Unique jobs feature is not working HOT 2
- expected :timeout to be an integer of :infinity HOT 2
- Feature Request: enqueue a batch of jobs atomically HOT 3
- Missing assign `:worker_module` HOT 2
- How many queues can I create? HOT 7
- How to configure Exq to push jobs to Sidekiq? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exq.