What I want from a CDN
I was looking around last night at different CDN solutions out there. Everything from Amazon’s new CloudFront to CacheFly to Limelight and a couple others.
All of them have different features and levels of performance but the one thing I really want to be able to do is on-demand invalidation. Regular TTLs are fine for static items like images, css, js, videos and the like. But what about regular HTML files? Most of today’s websites these days have pages that are dynamic in some way or another. What I would like to be able to do is generate a page, cache it in a CDN and then if/when needed tell the CDN to remove that file immediately. Not hours from now. From what I can tell, none of the solutions I looked at had that ability. CloudFront has a minimum TTL of 24 hours. Limelight is just over an hour. I couldn’t find the info on CacheFly.
Where I find this most appropriate is an ecommerce app. Say you have a product page that you want to cache. Makes sense, but what if you want to be proactive to the customer and let them know when that item is not longer in stock instead of waiting until they add it to the cart? That isn’t a very good customer experience.
I specifically mention ecommerce because one, I’ve worked for a big one and two it has been shown that reductions of mere milliseconds in latency increases revenue.
Surely there is a solution out there that can do this?
Don’t miss anything, subscribe!
Interesting hibernate transaction issue
I’m working on a new Grails based project and came across a transaction issue. The application is an ecommerce app and as such the placing of the order has a lot going on that should all reside in a transaction.
Being a Grails app I decided to put the processing inside a transactional service method. So far so good. The flow looks something like this:
- Create billing address
- Create credit card
- Assign billing address to card
- Create shipping address
- Loop through the cart items and for each item find stock(inventory) to fulfill each
- Mark the stock as sold as applied
- Add each order item to the order
- Assign order to customer
- Save order and customer
That is a little oversimplified, but you get the idea. So, what was the problem?
The problem came in during the select for the stock. This select would cause a hibernate exception about the address being a transient object. Well that made no sense at all.
At first I started down the road of abandoning the whole transaction thing and doing it manually. Naturally that was ugly and very error prone, so I did some research to find out what the cause might be. Came up empty.
My gut said that a select should not cause a problem with unsaved data. Then I thought that maybe hibernate was enforcing some sort of isolation level mechanism. Most of us never bother with database isolation levels (and fewer even know what they are sadly enough), but perhaps that was causing it. So what I did was move all the save() calls from the end to where they were being used.
In other words I called save on the two addresses and the credit card before the loops on getting and assigning stock.
Worked like a charm. I now have the whole thing in a transaction as it should be.
Don’t miss anything, subscribe!
My new app minus the RDBMS
I’ve been intrigued for some time about building an application on using a datastore that wasn’t a relational database. This “movement” as it were is being called “noSQL”.
My application is a search engine service. As such I don’t need much actual data that is stored in a database and I decided to forgo using trusty old MySQL for this job and try something different.
SimpleDB
So I decided to go with Amazon’s SimpleDB for this project. It has come a long way since I first looked at it and has all the query capabilities that I need.
If you aren’t familiar with SimpleDB, it is a schema-less setup where domains act as tables. The schema-less design means that the schema can accommodate new columns as needed. While not really necessary for my particular application, it is a feature.
What do I gain with SimpleDB? As traffic increases, I can spool up more servers (can you say Amazon’s EC2?) and since they communicate with SimpleDB, I don’t have to worry about a load on a central RDBMS.
The App
The app itself is built on Grails. For those familiar with Grails, it uses Hibernate under the covers as part of GORM. Well, I’m not using that obviously for this project. However since my query requirements are pretty minimal, that is not an issue. I only have a few domain objects and in most cases I get them by id.
Behind the grails app is Solr, the web app front end to Lucence indexing engine.
Initial development is about done and will be alpha tested behind an existing site that receives ~100k pageviews a month. I’ll give that a month or so and expand into beta testing.
Don’t miss anything, subscribe!
New gun bag for my AK
I finally got a gun bag for my AK. Got it from Desert Tactical and it is a 36″ bag with plenty of pockets and storage.
Here are some pics:
Still waiting for the new tapco magazines to come in as well as the lula loader.
Don’t miss anything, subscribe!
Sarah Palin’s new assault rifle
I wrote about it here, but the NRA is giving the governor a beautiful custom built .50 AR-15 style assault rifle in honor of her defense of the second amendment. Whether you like guns or not, the workmanship on this one is pretty spectacular.
Don’t miss anything, subscribe!


