Bah, just because a language is garbage-collected doesn’t mean it can’t have memory leaks:
#!/usr/bin/env ruby
foo = 'bar'
loop do
foo << 'bar'
end
In this case, I was using the return value of the to_s method of an object as part of the cache key for the main index page when I should have been using the value of the inspect method. For this particular object, to_s returned a String that included a unique object id which changed for every request, which meant that every request added a new instance of the index page to the cache in memory.
It wasn’t a permanent leak, since the cache entries automatically expired after 60 seconds, but on a high-traffic blog, the excessive per-request memory usage could have resulted in memory exhaustion.
Thursday April 17, 2008 @ 09:22 PM (PDT)
Posted by
wonko
Thoth supports freeform tagging, but doesn’t have support for fixed, predefined categories.
You can extend Thoth easily by writing plugins in Ruby. Plugins can override existing functionality (including controllers) or add new functionality. There’s a very basic example here.
Wednesday April 30, 2008 @ 02:05 PM (PDT)
Posted by
wonko
Thanks for responding to the categorization question, now a few more . . .
1. Routing/urls: let’s say I create an “About” page within Thoth. Is there any way I can specify a unique url that doesn’t contain “page”? So I am looking to achieve “http://myblog.org/about” as opposed to “http://myblog.org/page/about” Is there a way to do this?
2. How do I specify using MySQL upon blog creation (with the thoth command)? My system defaults to SQLLite3. Presumably I need to create the database first in MySQL?
3. Search doesn’t appear to be working.
4. Finally, is there a preferred contact area for asking questions (other than the wiki area for reporting issues)?
5. Um, where do the actual ramaze files reside for thoth? I thought about poking around for the routing, but I can’t
Great software, btw.
Thanks again,
Matt
Friday May 02, 2008 @ 07:38 AM (PDT)
Posted by
Matt
1. Thoth doesn’t allow you to configure routes, but this is a great idea. In the meantime, you could write a simple plugin that loads on startup and adds a Ramaze route like so: Ramaze::Route['/about'] = '/page/about'
2. You need to edit thoth.conf and change the database connection string. Once you’ve done that, create your MySQL database manually, then start Thoth and it will automatically create the necessary tables.
3. Thoth’s search currently uses the Yahoo! Search API rather than doing an internal search. Once your blog is public and has been indexed by the Yahoo! crawler, this should yield excellent results, but until then you won’t see anything. I’m currently working on internal search functionality for a future version of Thoth, but this is a very difficult thing to implement in a database-agnostic way.
5. Thoth’s core libs are installed as a gem, so they’ll be in your gem include directory. This differs from system to system, but if you run thoth -h, it’ll display the paths for the default public and view directories. The core libs are in the /lib directory under the same root dir as the public and view directories. I wouldn’t recommend modifying anything there though, since you’ll lose your changes when you upgrade or reinstall Thoth. It’s best to use plugins for custom modifications.
Friday May 02, 2008 @ 10:30 AM (PDT)
Posted by
wonko
Comments
Double take...
I didn’t know you could introduce memory leaks in Ruby. How did you manage to do that?
Re: Double take...
Bah, just because a language is garbage-collected doesn’t mean it can’t have memory leaks:
In this case, I was using the return value of the
to_smethod of an object as part of the cache key for the main index page when I should have been using the value of theinspectmethod. For this particular object,to_sreturned a String that included a unique object id which changed for every request, which meant that every request added a new instance of the index page to the cache in memory.It wasn’t a permanent leak, since the cache entries automatically expired after 60 seconds, but on a high-traffic blog, the excessive per-request memory usage could have resulted in memory exhaustion.
Re: Double take...
Good to know.
Thanks for the explanation!
Categorization
Would like to know more: does the thoth blog support some sort of categorization? Can it be extended with other Ramaze controllers, etc.
Thanks!
Re: Categorization
Thoth supports freeform tagging, but doesn’t have support for fixed, predefined categories.
You can extend Thoth easily by writing plugins in Ruby. Plugins can override existing functionality (including controllers) or add new functionality. There’s a very basic example here.
Thanks, but more questions
Thanks for responding to the categorization question, now a few more . . .
1. Routing/urls: let’s say I create an “About” page within Thoth. Is there any way I can specify a unique url that doesn’t contain “page”? So I am looking to achieve “http://myblog.org/about” as opposed to “http://myblog.org/page/about” Is there a way to do this?
2. How do I specify using MySQL upon blog creation (with the thoth command)? My system defaults to SQLLite3. Presumably I need to create the database first in MySQL?
3. Search doesn’t appear to be working.
4. Finally, is there a preferred contact area for asking questions (other than the wiki area for reporting issues)?
5. Um, where do the actual ramaze files reside for thoth? I thought about poking around for the routing, but I can’t
Great software, btw.
Thanks again,
Matt
Re: Thanks, but more questions
1. Thoth doesn’t allow you to configure routes, but this is a great idea. In the meantime, you could write a simple plugin that loads on startup and adds a Ramaze route like so:
Ramaze::Route['/about'] = '/page/about'2. You need to edit thoth.conf and change the database connection string. Once you’ve done that, create your MySQL database manually, then start Thoth and it will automatically create the necessary tables.
3. Thoth’s search currently uses the Yahoo! Search API rather than doing an internal search. Once your blog is public and has been indexed by the Yahoo! crawler, this should yield excellent results, but until then you won’t see anything. I’m currently working on internal search functionality for a future version of Thoth, but this is a very difficult thing to implement in a database-agnostic way.
4. Feel free to email me directly.
5. Thoth’s core libs are installed as a gem, so they’ll be in your gem include directory. This differs from system to system, but if you run
thoth -h, it’ll display the paths for the default public and view directories. The core libs are in the/libdirectory under the same root dir as the public and view directories. I wouldn’t recommend modifying anything there though, since you’ll lose your changes when you upgrade or reinstall Thoth. It’s best to use plugins for custom modifications.