-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General Concerns #140
Comments
Hi Ben, Thanks for the detailed writeup. I agree that there are definitely issues to be resolved, if we can discuss and prioritize those then we can create issues and start fixing them. Recently I have been focusing on getting the Redis job queueing and execution working with retries and reliable queueing - so that job are retried when failed, and in progress jobs are not lost if a worker dies (or orphan jobs as you mentioned). I wanted to get these in before doing any major architectural changes, and I feel like the system works well now in practice. But as you mentioned, it can definitely can be improved to make it easier to maintain as well as more idiomatic in terms of architecture, syntax, and supervision (I started committing to this in 2013 when there weren't as many great Elixir resources as today) I think the timing is great now to take a step back and look at some of the patterns used and take a stab at improving the code base. It also looks like you're handling a good amount of these which is great. I definitely agree with most of the things you mentioned. These are issues to be addressed (besides the ones included in your refactor):
Some comments:
After discussion, we can split these out into issues and can be there to be addressed. Thanks! |
@benwilson512 Good suggestion about the documentation, I've started working on a branch, see #141. I was also mistaken regarding the stats and retrying jobs, good catch, that definitely needs to be fixed. I can do that. I was also wondering if you had thoughts about using a GenEvent server to broadcast events about stats / jobs vs directly sending to the different components? Seems like one of the complication is that Exq allows custom named processes, so not sure if it will simplify that a bit (I noticed a lot of the libraries don't do this and just do module name). |
Documentation provided by #141 |
Hey! I apologize for taking so long to respond, the holidays required a lot of travel on my part and I wasn't able to make time. Your comments have been really encouraging, and I'm confident that the project is in good hands. I have not had much time to make progress on my branches, but I hope to this week. I'm really excited to see the progress made so far! |
@benwilson512 no worries, hope you had a good holiday, and looking forward to the changes! |
I believe most of these have been addressed except these which are listed issues:
Will close this issue unless any objections |
Over the course of working through the PR to fix #128 and #129 I've run into a variety of different problems that I'd like to discuss. These problems are unfortunate, because Exq serves a very important role in the community. Many people are coming from a Ruby / Rails background and Exq helps make integrating Elixir with existing Ruby systems much easier. Nonetheless, the problems I present here individually and in aggregate are serious enough to warrant great caution on the part of any who might consider using this library.
I bring these problems up not only because I want Exq to succeed, but because I only have the available time to fix a handful of the most serious ones. A lot of valuable work has gone into this library, particularly around managing the redis association in such a way as to be compatible with Sidekiq. I'm hopeful that this post will bring about awareness of the situation so that others can address what I cannot.
NOTE: Two of these I've already created separate issues for, but I include them here for the sake of completeness.
* indicates that it will be at least partially addressed in benwilson512#1
Severe Issues
start_link
.The ambiguities around supervision in general and job supervision in particular mean that I have no idea how this library behaves when I call ``./bin/myapp stop` via exrm for example. While it shuts down is it possible for a job to still get started? What happens to running jobs? Clarity here is paramount as I need to be sure that deploying new code to production will not orphan jobs.
General Issues
These are a hodgepodge of anti-patterns, code smells, and barriers to contribution.
{:ok, sup} = Exq.Enqueuer.start_link([port: 6379])
example from the readme would seem to indicate that individual components of the system can be started with custom configuration. However, the various hardcodedCode.get
calls mean that some parts will still fallback toExq
defaults whereas others will actually use the provided configuration.:ets
stuff should likely just be removed.handle_call({:retries}, _from, state)
why is :retries wrapped in a tuple? This pattern is ubiquitous.GenServer.start_link(__MODULE__, [opts], [])
and theninit([opts])
Logger.error("INVALID MESSAGE #{info}")
use GenServer
provides these basic callbacks alreadyCode.require_file "test_helper.exs", __DIR__
at the top.mix test
runs test_helper by default:timer.sleep
calls abound.Going Forward
These are the problems I've run into while trying to fix the supervision architecture. I have not yet had time to review in detail job lifecycle management, anything related to redis usage, nor the messaging patterns of the application.
I hope to have time during the next week or so to finish the changes I've started to improve the supervision tree. Notably, this may not include supervising the workers, as that should probably be addressed as part of a general look at job life cycle management. We will see.
Afterward, I believe the most useful next step would be documentation. What does each GenServer do? How does it interact with the other GenServers? What is the lifecycle of a job? Some clarity to these questions would go a long way towards facilitating further contributions that can improve upon the current state of affairs.
Once again I really do appreciate the effort that's been put into Exq, it is a valuable part of the Elixir community.
Thanks!
The text was updated successfully, but these errors were encountered: