Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Way to determine how backed up the reactor is?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brian  
View profile  
 More options Dec 27 2011, 3:39 am
From: Brian <barmstr...@gmail.com>
Date: Tue, 27 Dec 2011 00:39:52 -0800 (PST)
Local: Tues, Dec 27 2011 3:39 am
Subject: Way to determine how backed up the reactor is?
I was hoping to determine how many callbacks had been queued up
(scheduled?) in the main reactor.

I saw EventMachine::Queue.size but it looks like this is not a class
method, and can only be called on an instance of that class.  (maybe
some special queue object?)

What's the best way to get the queue size of the main reactor?  Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Krzysztof Wilczynski  
View profile  
 More options Jan 26, 10:13 pm
From: Krzysztof Wilczynski <krzysztof.wilczyn...@linux.com>
Date: Thu, 26 Jan 2012 19:13:31 -0800 (PST)
Local: Thurs, Jan 26 2012 10:13 pm
Subject: Re: Way to determine how backed up the reactor is?
Hi Brian,

I guess, you have probably already figured this out, but in case you
were not ...

> I was hoping to determine how many callbacks had been queued up
> (scheduled?) in the main reactor.

Since, its Ruby you can monkey-patch to expose internal queues:

module EventMachine
  def self.threadqueue
    @threadqueue
  end

  def self.resultqueue
    @resultqueue
  end
end

But this is probably not advisable (citation needed), etc.

> I saw EventMachine::Queue.size but it looks like this is not a class
> method, and can only be called on an instance of that class.  (maybe
> some special queue object?)

EventMachine::Queue is something completely different as you have
noticed.

> What's the best way to get the queue size of the main reactor?

Once you have monkey-patch in place, then for example:

EventMachine.run do
  EventMachine.threadpool_size = 1

  EM.add_periodic_timer(1) do
    p [EventMachine.threadqueue.size,
       EventMachine.resultqueue.size,
       EventMachine.threadqueue.num_waiting]
  end

  4.times do
    EventMachine.defer(Proc.new { sleep 5 }, Proc.new { p 'DONE' })
  end
end

I hope that helps :-)

P.S. For the API of Queue, check Ruby's documentation.

KW


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Tucker  
View profile  
 More options Feb 10, 2:10 am
From: James Tucker <jftuc...@gmail.com>
Date: Thu, 9 Feb 2012 23:10:24 -0800
Local: Fri, Feb 10 2012 2:10 am
Subject: Re: [EM] Re: Way to determine how backed up the reactor is?
Sorry for yet another top post.

This answer is confused, it only shows the size of the defer queue. There is currently no way to easily expose the size of the waiting callbacks in each tick.

On Jan 26, 2012, at 7:13 PM, Krzysztof Wilczynski wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Krzysztof Wilczynski  
View profile  
 More options Feb 11, 6:11 pm
From: Krzysztof Wilczynski <krzysztof.wilczyn...@linux.com>
Date: Sat, 11 Feb 2012 15:11:56 -0800 (PST)
Local: Sat, Feb 11 2012 6:11 pm
Subject: Re: Way to determine how backed up the reactor is?
Hi,

> Sorry for yet another top post.

:-)

> This answer is confused, it only shows the size of the defer queue. There is currently no way to easily expose the size of the waiting callbacks in each tick.

Oh, doh. You are right. Apologies for this :)

KW


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »