Hi, Dmitry What problem with AnyEvent::RabbitMQ do you have? Right now, I see that this module is updated 21th of march and it doesn't looks like unsupported.
Anyway, blocking library in non-blocking system is not a problem. But you should understand that is a potential bottleneck in whole application. Because if this library blocks - all your apllication will blocks. For example, if single request costs 1ms and you have 10rps - your application will locks for 10ms. But, if one of requests is longer than 1s - you will have the DOS. Best regards, Denis 2015-05-31 6:30 GMT+03:00 Bakanov Dmitriy <[email protected]>: > Hello, community > > Currently I have 2 Mojolicious applications. I want first application > notify second application about some messages it receives. I decided, that > RabbitMQ will be the best way to implement it, because RabbitMQ tool is > widespread, it has monitoring features, it's fast and allow flexibility. > But, I have some troubles to use RabbitMQ from mojolicious. There are > clients to RabbitMQ that allow non-blocking mode, but due to company's > coding standards I don't want to use unsupported client like > AnyEvent::RabbitMQ. Now I have the following Idea: > 1. I found a client https://github.com/markwellis/net-amqp-rabbitmq that > has some support and has commits in a recently few months > 2. Unfortunately, it's blocking. > 3. But I can call method 'get' to get messages from RabbitMQ if they > exist, or it will return undef, if there no messages > 4. I want to emit event 'receiving' in IOLoop and call Rabbit's 'get' > method. > 5. If there is a message I will emit 'received' event in IOLoop and then > will be handle it in callback. > 6. After this handling I will emit 'receiving' again. > 7. If there are no messages in 'receiving' call, I will start IOLoop's > timer to fire after 0.1 sec and emit 'receiving' in timer's callback > 8. So, I will have the system, that works non-blocking, using blocking > library (?) > 9. But I will have some overhead when RabbitMQ is idle, and I will be > check it every 0.1 sec. I think it's not a problem for me, because RabbitMQ > always should have a load in production. I did measured, that idle > Mojolicious in this 'receiving' mode don't consume much resources. Just a > 1-2% of CPU. But again, I think it really never will be idle. > > QUESTION: Do you see some pitfalls in this schema I have described? Is it > OK? > QUESTION 2: Maybe some advices to use another configuration or instruments > to achieve my goals? > > Thanks, > Dmitry > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- С уважением, Денис Федосеев -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
