Wednesday, April 20, 2011

Local Caching++

Ok, so you've built your application in Java. You've used all the usual tools. Tomcat, Spring, Ehcache, Quartz, etc. Or maybe you went the JRuby, Grails or Scala route. You test your new application or hand it off to run in production and it's too slow. This is just a single node application at this point. It services 20-100 users. It's churning and burning the database, creating and recreating the same Web Pages, Users and other relevant data. You want to start caching locally to solve your latency and throughput problems. Then, upon a more detailed look at your application, you get scared.

You find your application has:
  • 40 DB tables in Hibernate that can be cached
  • A web cache
  • A user session cache
Then it hits you. Caching is easy but cache tuning is hard.

What Makes Cache Tuning Hard?

In conversations with 100's of cache users there are actually a small handful of difficult to work through challenges applying caching to an application:

  • Hibernate/Lots of caches - When using Hibernate you often end up with as many as 100 tables in your DB. How do you balance a fixed amount of resources(Heap/BigMemory) across 100 caches?
  • Indirect knobs/Bytes vs Count/TTL - In local Java caching the control points are almost always measured in number of entries and time to live. But wait a minute! When I start the JVM I don't say how many objects the heap can hold and for how long. I say how many bytes of memory the heap can use?
  • Who Tunes and When? - At some companies the desire is to have the "Application Administrator" do the tuning. At others it's the "Developer." They have different understandings of the application. The developer can tune by knowledge of the application. The app admin can only tune based on what's happening when the application is running.
These are the challenges we are working to solve in the next version of Ehcache. While it's early days on the dev side we would love feedback on our approaches. You can get a sense of how it's going to work from the doc on ehcache.org.

What We Are Building

Greg, me and the dev team spent a bunch of time pondering the above problems over the last few years. We felt that with two key improvements to how people tune we could address most of the above (and a few more items hit the rest):

  • Tune from the top - Define max resource usage for the whole cache manager and then optionally define it for the individual caches underneath it as needed. So if you have a hundred caches you can start with, "Give these 100 caches N amounts of Heap/OffHeap." Then monitor and see if any specific caches need special attention.
  • Tune the constrained resource, Bytes - TTL is a cache freshness concern not a resource management concern. Max entry count does not directly map to available heap resources. So we are adding "bytes" based tuning. This eliminates the mistake prone process of trying to control resources by TTL/TTI/count and hope you get it right. Instead you say, "I want to allow caching to use 30 percent of heap." We take it from there.

Wrapping Up

With those two key improvements a developer or admin is now directly turning the knob (Size of cache in bytes) that maps to the resources available in the JVM and doing it at a global level or a local level as needed to avoid hard to tune individual cache constraints.

This will work with all of our JVM level cache tiers (onHeap, BigMemory, Disk).

When you put those features together with other items coming in the next major release like entry and cache pinning and a snapshotting bootstrapper for warming we feel like this will be a very powerful release.

Please check out the new docs and give us feedback by commenting on this blog or posting the the Ehcache forums.

Help us make Ehcache as easy to use and powerful as we possibly can.

Saturday, April 16, 2011

Where To Buy Your Apple Gear?

Most people who know me think I'm a bit of an Apple products junkie. I can't deny it. I'm a big fan of Apple products (Typing this blog on my 11.6 inch Macbook Air) and the way they package and reuse great ideas across devices. Being that I'm such a fan(boy) of the Apple ecosystem I'm regularly asked for advice from wood be purchasers when they want to pickup an Apple product. I'm writing this blog in order to provide that product purchase advice for my friends and family as well as for my readers who can't ask me verbally.


"Speed of Acquisition" vs "Help During Purchase" vs "Total Cost"

The decision making process for where to buy Apple products usually comes down to three major questions. How do you rate "Speed of Acquisition" vs "Help During Purchasing" vs "Total Cost?" (See diagram for the big picture on this issue). Once you know the answer to the above question based on your keen sense of self awareness you can then weight the various purchase options appropriately. For best results, Be Honest With Yourself!

NOTE: Many people think after sale help is somehow related to the purchase decision. IT IS NOT! The Apple store Genius bar will always help you no matter where you bought the device.


What's In The Cost?

When buying an Apple product there are 4 components to the cost of the device:
  1. The price tag of the device itself
  2. State sales tax
  3. Shipping and Handling
  4. What you can get thrown into the deal
Take into consideration all four points when looking at the price. You can often save over a hundred dollars in sales tax just by ordering from an out of state, online retailer! In addition, many of these online retailers ship for free. These online retailers usually have the best discounts aka "price tag" on devices as well. Check out the AppleInsider.com price guide. It will tell you where to get the best deal on any given Apple device and is kept very up to date. It's where I look and where you should too. Another thing to consider is that on some items MacMall and MacConnection are actually flexible and may throw in things like printers and bags if you call.


The Need For Speed?

Some people are impatient, some people need a computer right away, and others just like the experience of being first. These are all speed questions. In the speed world there are two categories of Apple products "Hot and Constrained" and "Generally Available."

Hot and Constrained

If we are talking about "Hot and Constrained" usually the fastest way to get a product is buying it from Apple. Either through their online store or going to an Apple Retail location. They stock themselves first. You may have to wait on lines but it's often your best and sometimes your only bet for acquiring new, hot, Apple devices.

General Availability

For "general availability" devices "fastest" is broken down again into two categories. Fastest online (Generally Amazon) and fastest brick and mortar (Generally Apple's stores). Amazon is generally the best place to buy anything online as far as fulfillment (How fast they get it to you, amount in stock, ease of using store, return policies) and Apple products are no exception. Amazon's prices aren't the absolute bottom but they are pretty darn good.

When buying from a retail store, Apple's is second to none. They get you in and out fast, have all the information you need, it's easy to find what you want and they have ton's of stock of everything Apple. The only downside is the sales tax and no discounts to speak of.


Help During Purchasing

This one doesn't apply to me as when it comes to Apple products I tend to know what I want. It's a hobby of mine to monitor Apple's products and product direction. I use product and business learning from Apple for inspiration in my job building Performance and Scale software (Probably a good blog topic as well. "How I Apply My Apple Learnings To My Business"). For the rest of the world, aka "normal people," who spend precious free time doing things like traveling, dating, hanging out with friends, help might be required. For those people you should probably lean towards either the Retail Apple Stores and or the online Apple Product specialists (MacMall and MacConnection) where they know everything about the devices and can help you make good decisions. For those who are like me, stick to "Total Cost" and "Speed" in your decision making process.


Conclusions

When looking to buy an Apple device one must evaluate a number of options. You should evaluate those options against a keen sense of self awareness? Can you wait, are you cost conscious, do you need help? By answering those questions and comparing the results against the "Apple Product Purchasing Guide" diagram below, the AppleInsider price guide and the above criteria you should be able to make the best possible decision for you.

Please let me know if you have any feedback about this blog. How can it be more helpful? Where did I get it wrong?



Wednesday, April 13, 2011

Please Strengthen My Weak LinkedIn Links...

State Of LinkedIn

I've had a LinkedIn account for many years. I find it an excellent tool for keeping tabs on ex-coworkers, recruiting new ones, and watching job trends. The problem I have is that those links/connections in LinkedIn can be weak. It doesn't take those connections to the next level by helping me manage the relationships. It doesn't help me manage and monitor the strengthen of my connections.

What Does Manage and Monitor Relationships Mean?

At a macro level I can keep track of my first level connections and second level connections. I can traverse these to help me find people to hire, ask for advice and even look for jobs myself. It even does a ton of stuff to help me find new connections by making suggestions, forming groups etc. But at a micro level it does nothing to help me improve and make value judgements about those relationships. I.e. I have a relationship with Joe the CEO of SomeCompany.com. By looking at that link I can't tell if that's a strong relationship or a weak one (Monitoring). I also can't set goals of improving my relationships and keep track of those goals (Managing). It just gives me a tree/graph of the relationships as if they were all the same. Further, when I'm traversing through my relationships and into my connections relationships I can't tell how strong they are connected to their connections.

What I Want...

What I really want is for LinkedIn to help me manage and improve my relationships as well. It would all be much more powerful if I could apply a rating to each relationship, monitor the relationship's progress and assign goals for each relationship. I could do so on a 1-10 scale.

So instead of a graph like this:



I could have a graph like this where the thickness of the lines indicated the quality of the relationship where it is right now:

That would be a great start. Then I would like it to keep a history of the relationship as well. It could show me how the relationship is progressing over time. Say it started at a 10 but I haven't talked to Joe in 3 years and now I rate it a 4. It could represent it with little arrows or color showing deterioration.

What about goals for a relationship? I could set a goal of 8 and do a query on all relationships that are not at the level I wish they were. It could remind me to make a quick contact with the person in question. It could auto deteriorate a relationship over time if I don't contact people.

Summing Up...

LinkedIn is great. I'm more connected than ever. But... I want to monitor and manage my links to improve my connectedness to certain people and I'm hoping linked in can help me.