DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Deploying Smart Contract on Ethereum Blockchain
  • Strategies for Reducing Total Cost of Ownership (TCO) For Integration Solutions
  • What ChatGPT Needs Is Context
  • Integrating AWS With Salesforce Using Terraform

Trending

  • Deploying Smart Contract on Ethereum Blockchain
  • Strategies for Reducing Total Cost of Ownership (TCO) For Integration Solutions
  • What ChatGPT Needs Is Context
  • Integrating AWS With Salesforce Using Terraform
  1. DZone
  2. Data Engineering
  3. Data
  4. Caching Over Mybatis – Summary of Approaches

Caching Over Mybatis – Summary of Approaches

Ana-Maria Mihalceanu user avatar by
Ana-Maria Mihalceanu
·
Jan. 06, 15 · Interview
Like (0)
Save
Tweet
Share
3.92K Views

Join the DZone community and get the full member experience.

Join For Free

This article presents a summary of the four Proof of Concepts described in the article 4 Hands-On Approaches to Improve Your Data Access Layer Implementation  and contains a retrospective of the four implementations, with a comparison table of their key features.

Code for implementations can be accessed at https://github.com/ammbra/CacherPoc .

Before analyzing the results we obtained through the four implementations, I would like to remind the goal of these articles: to illustrate through usage the behavior of MyBatis cache implementations with Ehcache, Hazelcast, Memcached and OSCache.  A more complex view of CacherPOC and its associates is presented below:


and the online view of the application:


I am going to detail my opinions about the four libraries, after concept's implementation.

All the used libraries (Ehcache, OSCache, Memcached and Hazelcast) support in memory data management, transactions and have the following attributes:

  • atomicity
  • consistency
  • isolation
  • durability (durability of data handling as ACID integrity model specifies)
  • horizontal scalable
  • automatic deletion after expiration
  • embedable
  • open source
  • function on cross-platform operating systems

Also, let's investigate what differentiate them in terms of features:

Characteristic

Ehcache

Hazelcast

Memcached

OSCache

The language the software is written in

Java

C#, Java, .net, C++

C#

Java

Database model

Key-Value

Distributed data structure

NoSQL

Schema-less

Key-Value

Distributed data structure

NoSQL

Schema-less

Publish/Subscribe

Key-Value

Key-Value

Integrity model

ACID

ACID

MVCC

Serializable

ACID

ACID

Maximum size of a single value

8GB

10MB

1MB

?

Conditional entry updates

Yes

Yes

No

No

Composite key

Yes

Yes

No

No

Locking model

Optimistic Locking

Optimistic Locking

Pessimistic Locking

Distributed Locking

Lock Free Model

?

Data Storage

Volatile Memory

File System

Volatile Memory

Relational DB

Volatile Memory

Volatile Memory

Backup Functionality

Good

Good

Basic

?

Second level caching

Yes

Yes

No

No

Cloud platform support

?

Amazon EC2

?

?

Map and reduce

?

Yes

No

?

? - could not be determined

Based on features list, we can choose a caching implementation. But the most important evidence came from CacherPOC project: the results obtained when Amdhal's law was applied.

Amdhal's law is 

where P is proportion speed up and S is speed up.

Below are listed the results obtained by :

  • Ehcache implementation : 2 times system speedup
  •  Hazelcast implementation : 1.96 times system speedup
  • Memcached implementation: 2.083 times system speedup
  • Oscache implementation: 2.028 times system speedup

The results obtained show Memcached as  the winner of caching over mybatis competition, but do not forget that it was tested a simple select; have in mind that complex operation might show another framework to be more suitable for caching over MyBatis. My recommendation would be: download CacherPOC, modify with the complex operations that you should test and check your own system speedup by using Amdhal's law. CacherPOC represents the base of complex future system tests.

Learn more from:

  • MyBatis Documentation
  • MyBatis Ehcache Adapter
  • MyBatis Hazelcast Adapter
  • MyBatis OSCache Adapter
  • MyBatis Memcached Adapter
MyBatis Cache (computing) File system Implementation philosophy

Opinions expressed by DZone contributors are their own.

Trending

  • Deploying Smart Contract on Ethereum Blockchain
  • Strategies for Reducing Total Cost of Ownership (TCO) For Integration Solutions
  • What ChatGPT Needs Is Context
  • Integrating AWS With Salesforce Using Terraform

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: