Phusion Passenger and memcache

One of my recently deployed Rails app uses memcache with Phusion Passenger. I read on the Phusion documentation about the possibility of corrupted commands issued to memcache through the spawned processes within Passenger.

I added the declarations below within the config/environment.rb file to overcome this issue:


      begin
         PhusionPassenger.on_event(:starting_worker_process) do |forked|
             if forked
               # We're in smart spawning mode, so...
               # Close duplicated memcached connections - they will open themselves
                 CACHE.reset
             end
         end
     # In case you're not running under Passenger (i.e. devmode with mongrel)
     rescue NameError => error
   end
 

The CACHE constant is set within the cache_fu plugin. All the declaration does is similar to that outlined in the Appendix of the Phusion documentation with the addition of the ‘begin..rescue’ block to counteract exceptions which may arise.

I understand from comments on the Passenger google group that cache_fu causes problems with memcached. If anyone has any further information on the above please feel free to comment.

Tagged with:
 

New Year Resolutions 2010

Happy New Year 2010

I’m not a firm believer of new year resolutions as I tend not to be able to keep them for some reason or other. But I thought for 2010 I might try a different approach and adopt some to keep myself occupied while waiting for my next gig.

The list below is by no way complete ( in fact, a simple app could be built to manage it??):

Write more regular blog posts

At least once or twice a week. May not have to be technical but at least topical

List of technologies to look out for:

2010 is going to be an exciting time for the development of Rails 3 but also in these areas I’m particularly
interested in: cloud computing; collaborative map-reduce problem solving; HTML 5; new schemaless databases

Keep more up to date than before

I tend to spend too much time on projects so the idea is to speed up development so I can have
more free time to myself to keep up to date with the latest and greatest as well as for my personal life.
This means rethinking on my current way of working and applying the 80-20 principle

Be Faster,Better,Stronger

No pun intended on the Daft Punk song but to be better and faster at what I can do

Also a big Thank You to all those who supported 29 Steps. All my best wishes to you for 2010.