Maintaining data in memory in RESTful APIs

Coding Adventures

As mentioned in my first post, I was trying to decide what technologies to use for a RESTful API. Ruby on Rails is my first option, but I’ve read that it isn’t the fastest technology. So, I coded a small proof of concept to see how RoR would perform in handling some typical requests for a RESTful API.

I began by creating a simple model, lets call it ClazzA, with only 2 attributes, attr1 and attr2.

I used the application default controller application_controller.rb, to add a get_all and create actions mapped to /classA route’s GET and POST methods respectively.

The get_all action returns a JSON array with all the saved models. The create action expects attr1 and attr2 as parameters to create a new model instance and save it to the database.

So far, so good. We can now create and list all instances of ClazzA.

Now, suppose that…

View original post 249 more words