Home > Blogs > VMware vFabric Blog > Tag Archives: grails

Tag Archives: grails

10 Lessons from Spring Applied to Java Virtualization with vFabric

The Spring Framework became the de-facto standard for developing enterprise Java applications, and its radical simplicity was fundamental to its success. Why the “radical” simplicity? Because at the time, it was hard to imagine how creating such applications could be made simple.

By tackling issues such as portability, understanding the importance of cross-cutting concerns, and making it trivial to develop automated tests, Spring allowed developers to focus on what matters: what makes their application unique.

As I was pulling together my presentation for SpringOne2GX 2012, I reflected on the parallels between Spring’s success and the direction we were going with EM4J. Why did Spring succeed? Why did simplification win? Where are we replicating these patterns within VMware, vFabric, and Java?

In short, complexity is expensive, and simplification has many economic benefits. By giving people better, simpler, and easier to use tools to help build, run, and manage applications, we create economic advantages.

In a nutshell, there are some core reasons why Spring succeeded, “Spring values” if you will: Reducing complexity, increasing productivity, provisioning flexibility, tooling and monitoring, extensibility, automation, flexible integration and ease of testing. Continue reading

Introducing A New Reference Architecture That Will Speed Knowledge & Development of Modern Cloud Applications

Technology is evolving at breakneck speeds.

Universally, applications are faster, deal with large data sets, and provide more compelling user experiences than ever before.

Competition is steep.

As a result, competitive organizations demand that IT leaders speed the rate of new application innovation and development.  IT must rise to the challenge or face competitive threats, missed business opportunities, and lose momentum within their user base. In short, IT leaders and providers that do not accelerate will face a backlash from executives.

In order to meet these challenges, IT is renovating application architectures to thrive in the cloud. This is an organization-wide change involving people redirection, process redesign, and technology exploitation. For many, there is a steep learning curve. Continue reading

Build Your First Mobile App in the Cloud in 45 Minutes (Tutorial)

Two of the hottest topics in technology today are “mobile” and “cloud.” They are at the top of most CTOs list of objectives, yet they also seem to be the ones most shrouded in mystery. So where do you start?

With the video and do-it-yourself guide below!

This past year, at VMworld 2012 San Francisco and Barcelona, I ran a session where we built a complete database-backed web application from scratch using the SpringSource Tool Suite and the Grails framework for Java. Then, we published the application to Cloud Foundry—our open Platform-as-a-Service offering. Finally, we proceeded to build a mobile application that consumed the data from the web application built earlier.  I broke a cardinal rule by doing the entire session live, but it all went off without a hitch and audience participation with the application was an absolute blast. By the time we were done, we had built two applications from the ground up, and folks had an application that looked, smelled, and tasted like a native mobile application running on their phones. And, we did all of this in less than one hour! Continue reading

3 Steps on Using Spring Insight Developer to Analyze Code

If you don’t know about Spring Insight Developer, this post may save you tons of time and potentially headache.

Imagine that you need to update some code behind a button, but you didn’t write the code. What if you could press the to-be-coded button and then see what code was invoked (including methods and arguments), the SQL invoked, and the time it took to execute?

This is what Spring Insight Developer allows you to do, and more.

It’s also free, and it uses AspectJ and AOP to load-time weave your application, you do not have to make any changes to your application code to use it.

Let’s take a look at a simple example of tracing your app, viewing the details, and seeing the code in action.

Continue reading

SpringSource, Cloud Foundry, and vFabric Teams at #JavaOne

VMware at JavaOneVMware is heading to JavaOne this week (right next door to Oracle Open World where you can also find us at booth #1733) As the providers of the ever popular Spring framework, its no surprise we have a packed show planned.

We are speaking at 7 sessions at JavaOne this week, talking about how Spring remains at the forefront of enterprise java with VMware’s solutions for big data, NoSQL, and cloud portability. We are also giving away CloudFoundry T-Shirts, SpringSource schwag, and PreshavedYak Hoodies (for those with a CloudFoundry “hello world” they can show us). Come find us at our sessions (below) or on the show floor at booth #5302 at the Hilton Union Square.

Continue reading

SQLFire and Grails

Chris Harris has written a series of blog posts showing how to use SQLFire from within Grails. In the process he introduces a couple of very interesting features of SQLFire that I wanted to talk more about, specifically how your app should take advantage of SQLFire's elasticity and the possibility of using SQLFire as a cache. Grails is a web development framework based on the Groovy programming language, and is designed to make writing web applications quick and painless. Using SQLFire from Grails is quite simple, mainly because SQLFire supports a JDBC interface, so connecting Grails apps to SQLFire only requires changing two lines.

Getting Started With SQLFire and Grails

Chris's first post shows the basics of creating an application and connecting it to SQLFire. All total there are 10 lines of code, excluding whitespace, which is really good considering Chris introduces constraints around maximum and minimum valid name lengths. The "grails create-controller" command handles the messy details of actually doing these constraint checks so the developer can focus on more important things.

Taking Advantage of SQLFire's Elasticity

Next, Chris introduces the concept of the SQLFire Locator. SQLFire is elastic by design, meaning that you can add and remove nodes whenever you want. When you do that, data is automatically rebalanced across all SQLFire nodes. You can see how this could be a problem, your app needs to be sure it's talking to something that's not going to go away some time in the future. SQLFire solves this using things called Locators. Locators keep track of what nodes exist in the SQLFire system and where data resides within the system. They are also persistent so your app can rely on the Locator to always be in the same place.

Let's look at an example. In this example we have a SQLFire system with two nodes and a locator.  Two Node SQLFire System With Locator

Now let's say that either the size of the database needs to grow or we need to add more processing power to it. We can just add a node. Again, when we do that the data is automatically shared with the new node and balanced across the whole system. Since the app is talking to the locator it doesn't notice any changes.

Three Node SQLFire System With Locator
The reverse works as well, if I need to get rid of a node I can just pull it out and my app will keep working fine. Chris's second blog post shows how this works in Grails. There's not much to it really, in Grails just make sure your JDBC URL points to the Locator.

SQLFire as a cache

Chris's third post shows how you can use SQLFire as an in-memory frontend to a MySQL database. Let's be clear, SQLFire is a real database, you can store your application's real data inside it, back it up, restore it, do all the things you would do with databases you're used to. There's no need to pair SQLFire with another database, but there are times when you may want to do it. For example you may have a data warehouse with huge amounts of data you wouldn't want to try to fit in memory.

Another common thing these days is people who hit a performance wall with their database, so they look at putting an in-memory cache on top of the database, such as memcache. This has worked very well but introduces a lot of complexity, for one thing you've got a new set of software you have to care and feed, as well as a new and incompatible set of APIs to access in-memory data versus on-disk data. Adding this sort of in-memory layer introduces a lot of stack complexity both for developers and operations.

When we look at relational databases, we believe that ultimately SQLFire is a better choice than using a combination of relational database plus any sort of in-memory caching. After all, why care for 2 databases when you only need 1? However it takes time to get there and until it happens SQLFire as a cache in front of an RDBMs may be the right thing for many people. It's less disruptive than a switch directly to an in-memory database, and is less complex than introducing a non-relational cache on top of a relational database.

Whatever the case may be Chris shows that it's pretty easy to make SQLFire into an in-memory cache on top of a MySQL database. The magic is in a couple of CALL commands made within the sqlf utility. Note that Chris does not need to write code that maps the SQLFire tables to the MySQL tables, this is the advantage of our cache being a real SQL database, we don't have to go through this error-prone process like we would if we were using something like memcache.

Thanks Chris for your hard work in writing these blog posts and I hope we can continue to see more from you.

As always to learn more or ask questions be sure to join our community to connect with the experts.