The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Wee goes Modal (Continuations)

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Michael Neumann

Posts: 66
Nickname: backflash
Registered: May, 2003

Michael Neumann is fallen in Love with Ruby
Wee goes Modal (Continuations) Posted: Oct 29, 2004 10:00 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Michael Neumann.
Original Post: Wee goes Modal (Continuations)
Feed Title: Mike's Weblog
Feed URL: http://www.ntecs.de/blog-old/index.rss?cat=ruby&count=7
Feed Description: Blogging about Ruby and other interesting stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Michael Neumann
Latest Posts From Mike's Weblog

Advertisement
This morning, I added support for continuation-based programming to Wee. It's now one step closer to Seaside2 or Borges. But I still support non-continuation-based apps. After changing half a dozen of lines, it was done, or so I thought. But then, I realized that you can't call continuations across threads. After wrapping each session into it's own thread and communicating with the application via two queues, and setting Thread.abort_on_exception=true to find some minor bugs, it really worked!

The rest of the day I fighted against some memory issues. To detect them, I was in the need for a simple stress testing application. Thus, I patched WebUnit, to support redirects and <br/> tags, then wrote a memory observer with GNUplot output and finally the stress tester.

I run the tests with all recent versions of Ruby, then I realized that the leak must be in my program and not in Ruby. More or less quickly I discovered that I had a reference back to the continuation in the called component, which resulted in the continuation not being freed as the continuatin has itself a reference to the component on the procedure stack. Assigning nil fixed the bug.

Below is the memory usage of Wee with continuations running under ruby-current as of today. I stressed it with 50 processes, i.e. 50 active sessions (= 50 Ruby threads), and a total of 100000 requests (in 10 minutes). It stayed below 22MB, that's 500kB per session. It still slightly increases over the time, not sure whether this is GC related or not (fragmentation?). I'll have to stress it over night ;-)

Read: Wee goes Modal (Continuations)

Topic: RubyConf Presentation: Dry Run Previous Topic   Next Topic Topic: Net::SSH Refactoring Adventure

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use