Summary of My Rails/Ackbar/KirbyBase Experiment
I’ve had several days to reflect on my experience, which was to work through the Depot application in Agile Web Development with Rails, using Ackbar/KirbyBase as a database backend instead of MySQL.
I’m very happy with the fact that it was a success. I was able to build the complete application, with all of the same functionality of the book’s app. Along, the way, there were a couple of bugs, but these were quickly fixed by Assaph.
The success of this experiment encouraged me to begin porting an existing client/server database app, which I originally wrote using FXRuby and MySQL, to Rails/Ackbar/KirbyBase. I am approximately half-way through the re-write and have not run into any problems so far.
So, this experiment did answer one important question for me: Is it possible to write Rails applications using Ackbar/KirbyBase? Yes, it is.
Granted, the application I’m porting will run on an intranet, have a total of approximately 40 users, and will probably never have more than 5-10 concurrent users at any one time.
Would I use Ackbar/KirbyBase to develop a Rails application that would have tens of thousands of hits every day? Probably not.
One of the reasons I enjoyed developing a Rails app with Ackbar/KirbyBase is that it is so easy to view the data while writing/testing code. Simply do a “cat tablename.tbl”, or open it up in your editor.
Another advantage was the ability, if I wanted to, to use one language, Ruby, for everything: write database creation scripts, write #find queries, etc. No switching back and forth between Ruby and SQL.
And probably the biggest advantage of using Ackbar/KirbyBase instead of MySQL for this experiment was the incredibly easy installation and configuration. Since Ackbar and KirbyBase are both pure-Ruby and available as gems, installing them on your box is a simple “gem install ackbar”. Setting up Rails to use Ackbar involves adding one line to your Rails environment.rb file and modifying your database.yml file to set the adapter to kirbybase. That’s it!
One thing did worry me when performing the experiment. I was using KirbyBase in single-user, embedded mode while writing the Depot application. This wasn’t an issue, since I was the only user. Additionally, since (I think) Webrick only processes one client request at a time, there would be no concurrency issues.
However, in a production setting, multiple users would be hitting the Depot app at the same time. So, I fired up a server instance of KirbyBase using the kbserver.rb script that is included in the distribution. Next, I modified database.yml to point my app at the KirbyBase server. I opened up Firefox and pointed it at the Depot app. It worked like a charm.
This is important for a couple of reasons:
- When you run KirbyBase in client/server mode, it takes care of all of the messy details for you like concurrent access and locking.
- KirbyBase has the ability to create and use indexes that can dramatically speed-up queries. When you first start KirbyBase in client/server mode, it immediately creates these indexes in memory so that they are available for use. User’s don’t have to wait for their client-side process to build the indexes upon startup. Ackbar does not yet take advantage of KirbyBase indexes (except for the built-in recno index), but it is something that Assaph and I think can be added in the future.
So, where does that leave us? Well, I know that Assaph is hard at work on the next version of Pimki, which, I think, will support both SQLite and KirbyBase. He also has a lot of ideas for improvements to Ackbar.
Some of the improvements he has mentioned would be:
- Have Ackbar/KirbyBase handle even more SQL syntax (for example, the ‘LIKE’ operator).
- Have Ackbar automatically use KirbyBase indexes if they are available.
- Possibly getting Rails has_one and has_many to map directly to KirbyBase’s Lookup and Link_many types, respectively.
I’ve got homework, too. There are some things I can improve in KirbyBase, like having each KBTable manage an array of KBColumn instances, instead of the kludgy way KirbyBase currently handles columns. Additionally, I am going to try to give Assaph a hand getting Ackbar to use KirbyBase indexes.
One of the other ways I plan on helping is to keep developing/testing using Rails with Ackbar/KirbyBase. Hopefully, this will help uncover and squash more bugs, and give more ideas for ways to improve both Ackbar and KirbyBase.
If you get the chance to play with Ackbar/KirbyBase, or better yet, use it in developing an actual application, please drop either Assaph or myself a line. I think I can speak for him when I say that we would love to hear about your experiences, both positive and negative.
In conclusion, I would like to mention that Assaph has been great to work with on all of this. I think his development of Ackbar is brilliant. He’s always been quick to respond to my questions and bug reports. I’m very much looking forward to working with him to make both Ackbar and KirbyBase better.