May 21, 2008

Cache::Swifty now on CPAN

Yesterday (the day has just change here in Japan), I uploaded Cache::Swifty to CPAN, a perl frontend for the very fast, memory-mapped cache: swifty.

Although you still have to install swifty manually, I hope it would release the pain of installing a perl module manually.

May 20, 2008

Slides from YAPC::Asia 2008 on MySQL Tuning in Pathtraq

Last friday I had a chance to give a talk at YAPC::Asia 2008 on the internals of Pathtraq, one of the largest web access stats service in Japan.

The talk covered from techniques we use for compressing data on MySQL tables, our cache architecture, and a mysql-based message queue (Q4M) that we developed and use.

The slides of the talk are available at, so please have a look.

April 16, 2008

Embedded SQL in Perl

Today I wrote a tiny module Filter::SQL, a module that enables embedding SQL in perl.

    Filter::SQL - embedded SQL for perl

      use Filter::SQL;

      Filter::SQL->dbh(DBI->connect('dbi:...')) or die DBI->errstr;

      EXEC CREATE TABLE t (v int not null);;

      $v = 12345;
      INSERT INTO t (v) VALUES ($v);;
      foreach my $row (SELECT * FROM t;) {
          print "v: $row[0]\n";

      if (SELECT ROW COUNT(*) FROM t; == 1) {
          print "1 row in table\n";

After writing the module, people told me of similar modules like SQL::Preproc. Compared to SQL::Preproc, Filter::SQL does not provide conformance to Embedded-SQL, but may be easy to use for ordinally perl programmers. There are also modules like DBIx::Perlish that seems to tackle the same problem from a bit different direction. Anyway certainly TMTOWTDI, we have the right choose what you like, and I hope Filter::SQL would be a good choice for some of us.

October 10, 2007

Swifty 0.06

This is a minor bugfix release from Swifty 0.05 and Cache::Swifty 0.05.

Bugs fixed are as follows:

  • fix build problem on i386 systems
  • only set do_refresh flag if the flag is not yet being set
  • handle EINTR when calling flock
  • add destructor (perl only)

September 27, 2007

KeyedMutex - a mutex for web services

Yesterday, I wrote:

Normally, a cache entry has a single lifetime. The problem is that if a cache entry is read frequently and if it takes time to update the entry, a situation known as thundering herd would occur on expiration; i.e. many cache consumers will detect expiration and send same update requests to the backend, causing a performance decline. There are two solutions to the problem:
  • use a proxy that combines identical update requests as a single request
  • initiate an update request prior to expiration, when lifetime being left gets below a certain threshold

Kazuho at Work: Swifty 0.05 and the Thundering Herd

As a complement for the second appoarch I took in Swifty 0.05, I wrote a tiny server that enforces exclusive access to databases. Actually it is not a proxy but works much like a mutex object between processes, but has a slightly different interface to fit into the realities of web services. Here comes the sample code.

Continue reading "KeyedMutex - a mutex for web services" »

September 26, 2007

Swifty 0.05 and the Thundering Herd

This is the release announcement of swifty 0.05.

Changes from previous version (0.03) are:

  • added code to support PowerPC and SPARC (not tested at all)
  • added internal checksum routine to guaranty integrity of cached data
  • added refresh_before property

About the refresh_before property

Continue reading "Swifty 0.05 and the Thundering Herd" »

September 18, 2007

Swifty 0.03

This is the release announcement of swifty version 0.03 and its perl binding Cache-Swifty 0.03.

To install swifty, run configure, make, and make install. To install Cache-Swifty, run perl Makefile.PL, make, and make install. Changes from the previous version are:

  1. change cache model from direct map to n-way set associative (max. of n is 64)
  2. bug fixes
  3. optimizations in perl binding

Continue reading "Swifty 0.03" »

April 09, 2007

Japanize & Mylingual at YAPC

Last week at YAPC::Asia 2007 Tokyo, I had the opportunity to give a presentation on Japanize and Mylingual. Although my notebook computer hung up twice :-( during the presentation, it was a great time for me, not to mention the entire event. Kudos to the staff!

Below are the slides I used.

[Restart] [Prev] [Next] [Download .ppt file]

BTW, I fixed the feed URLs linked from the per-language translation list pages, so that the tranlators can be notified of their updates. Sorry for your inconvenience.

April 03, 2006


I have just released PERL5WEBDB, a perl CGI debugger that runs on the web browser.

For more information, please visit Application archive and PowerPoint presentation slides (used at YAPC::Asia::2006) are avialable.