How to run integration tests at warp speed using Docker and tmpfs

Introduction

As previously explained, you can run database integration tests 20 times faster! The trick is to map the data directory in memory, and my previous article showed you what changes you need to do when you have a PostgreSQL or MySQL instance on your machine.

In this post, I’m going to expand the original idea, and show you how you can achieve the same goal using Docker and tmpfs.

Continue reading “How to run integration tests at warp speed using Docker and tmpfs”

Advertisements

The print version of High-Performance Java Persistence

One year after I published the first part of the High-Performance Java Persistence, I managed to publish the print version of the book.

The book is printed on demand using Amazon CreateSpace, and it looks like as follows.

Continue reading “The print version of High-Performance Java Persistence”

14 High-Performance Java Persistence Tips

Introduction

A high-performance data access layer requires a lot of knowledge about database internals, JDBC, JPA, Hibernate, and this post summarizes some of the most important techniques you can use to optimize your enterprise application.

1. SQL statement logging

If you’re using a framework that generates statements on your behalf, you should always validate each statement effectiveness and efficiency. A testing-time assertion mechanism is even better because you can catch N+1 query problems even before you commit your code.

2. Connection management

Database connections are expensive, therefore you should always use a connection pooling mechanism.

Because the number of connections is given by the capabilities of the underlying database cluster, you need to release connections as fast as possible.

In performance tuning, you always have to measure, and setting the right pool size is no different. A tool like FlexyPool can help you find the right size even after you deployed your application into production.

Continue reading “14 High-Performance Java Persistence Tips”