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 Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Microservices Topics

article thumbnail
An Overview of Meta-Monitoring
Meta-monitoring is basically self-service for monitoring. There are several different requirements and methods that should be kept in mind when it comes to meta-monitoring.
December 15, 2016
by Thomas Kurian Theakanath
· 6,047 Views · 2 Likes
article thumbnail
Deploying Microservices: Spring Cloud vs. Kubernetes
When it comes to deploying microservices, which is better — Spring Cloud or Kubernetes? The answer is both, but they shine in different ways.
December 13, 2016
by Bilgin Ibryam
· 196,644 Views · 104 Likes
article thumbnail
Making Elasticsearch in Docker Swarm Truly Elastic
Running a truly elastic Elasticsearch cluster on Docker Swarm is hard. Here's how to get past Elasticsearch and Docker's pitfalls with IP addresses, networking, and more.
December 13, 2016
by Stefan Thies
· 13,867 Views · 14 Likes
article thumbnail
How Small Should Microservices Be?
There are tons of different perspectives regarding the best size and granularity of microservices. Which perspective is best for your project?
December 12, 2016
by Grygoriy Gonchar
· 16,284 Views · 8 Likes
article thumbnail
Mastering the Couchbase N1QL Shell: Connection Management and Security
Couchbase's cbq shell lets you write and run N1QL queries interactively. The shell also lets you securely interact with mixed nodes, among other handy tricks.
December 9, 2016
by Isha Kandaswamy
· 8,722 Views · 5 Likes
article thumbnail
Create a REST API with Speedment and Spring
You can build a complete REST API with almost no manual coding using open-source Speedment and Spring.
December 9, 2016
by Emil Forslund
· 12,575 Views · 7 Likes
article thumbnail
ConcurrentHashMap isn't always enough
When Java developers come to a task of writing a a new class which should have a Map datastructure field, accessed simultaneously by several threads, they usually try to solve the synchronization issues invloved in such a scenario by simply making the map an instance of ConcurrentHashMap . public class Foo { private Map theMap = new ConcurrentHashMap<>(); // the rest of the class goes here... } In many cases it works fine just because the contract of ConcurrentHashMap takes care of the potential synchronization issues related to reading/writing to the map. But there are cases where it's not enough, and a developer gets race conditions which are hard to predict, and even harder to find/debug and fix. Let's have a look, at the next example: public class Foo { private Map theMap = new ConcurrentHashMap<>(); public Object getOrCreate(String key) { Object value = theMap.get(key); if (value == null) { value = new Object(); theMap.put(key, value); } return value; } } Here we have a "simple" getter ( getOrCreate(String key) ), which gets a key and returns the value assosiated with the given key in theMap . If there is no mapping for the key, the method creates a new value, inserts it into theMap and returns it. So far so good. But what happens when 2 (or more) threads call the getter with the same key when there is no mapping for the key in theMap? In such a case we might receive a race condition: Suppose thread t1 enters the function and comes to line 7. Its value is null . At this point thread t2 enters the function and also comes to line 7. Its value is also obviously null . Therefore from this point the two threads will enter the if statement and execute lines 8 and 9, thus creating two different new Objects. Upon returning from the getter each thread will get a different Object instance, violating programmer's wrong assumption that by using ConcurrentHashMap "everything is synchronized" and therefore two different threads should get the same value for the same key. To solve this issue we can synchronize the entire method, thus making it atomic: public class Foo { private Map theMap = new ConcurrentHashMap<>(); public synchronized Object getOrCreate(String key) { Object value = theMap.get(key); if (value == null) { value = new Object(); theMap.put(key, value); } return value; } } But this is a bit ugly, and uses Foo instace's monitor, which may affect performance if there are other methods in this class which are synchronized. Also a common rule of thumb is to try to eliminate using synchronized methods as much as possible. A much better approach should be using Java 8 Map's computeIfAbsent(K key, Function mappingFunction), which, in ConcurrentHashMap's implementation runs atomically: public class Foo { private Map theMap = new ConcurrentHashMap<>(); public Object getOrCreate(String key) { return theMap.computeIfAbsent(key, k -> new Object()); } } The atomicity of computeIfAbsent(..) assures that only one new Object will be created and put into theMap, and it'll be the exact same instance of Object that will be returned to all threads calling the getOrCreate function. Here, not only the code is correct, it's also cleaner and much shorter. The point of this example was to introduce a common pitfall of blindly relying on ConcurrentHashMap as a majical synchronzed datastructure which is threadsafe and therefore should solve all our concurrency issues regarding multiple threads working on a shared Map. ConcurrentHashMap is, indeed, threadsafe. But it only means that all read/write operations on such map are internally synchronized. And sometimes it's just not enough for our concurrent environment needs, and we have to use some special treatment which will guarantee atomic execution. A good practice will be to use one of the atomic methods implemented by ConcurrentHashMap, i.e: computeIfAbsent(..), putIfAbsent(..), etc.
December 8, 2016
by Dima Leah
· 48,902 Views · 12 Likes
article thumbnail
How to Compose an Infinispan Docker Image
Read on to explore how to create multicontainer Docker applications involving Infinispan with the help of Docker Compose.
December 7, 2016
by Manik Surtani
· 7,380 Views · 3 Likes
article thumbnail
Top 5 Factors That Impact Your Software Performance
Knowing where your software is failing is essential to identifying the bottleneck. These five performance-impacting factors give you a good place to start.
December 7, 2016
by Thamwika Bergstrom
· 6,984 Views · 3 Likes
article thumbnail
A Review of Java Template Engines
In this article, Miro Kopecky provides a thorough review of Java template engines Apache Velocity, Apache FreeMarker, Thymeleaf, and Pebble.
December 2, 2016
by Miro Wengner
· 87,190 Views · 12 Likes
article thumbnail
Testing a Node.JS Application Within a Docker Container
Learn how to take advantage of the Docker image layering model to run unit or component tests in a Docker container without polluting the production software.
November 29, 2016
by Nahshon Una-Tsameret
· 57,459 Views · 8 Likes
article thumbnail
A Review of Template Engines: What Next After Velocity?
With Velocity deprecated, let's take a walk through some other popular template engines to see what works best where.
November 28, 2016
by Miro Wengner
· 82,736 Views · 7 Likes
article thumbnail
Logging Docker Containers With AWS Cloudwatch
This post describes how to set up the integration between Docker and AWS and then establish a pipeline of logs from CloudWatch into the ELK Stack.
November 28, 2016
by Daniel Berman
· 10,124 Views · 3 Likes
article thumbnail
Health Checking Your Docker Containers
Are your containers feeling under the weather? Struggling to get out of bed? See how you can build in health checks to make sure your containers are fighting fit.
November 25, 2016
by Arun Gupta
· 53,239 Views · 9 Likes
article thumbnail
HDFS Cheat Sheet
This article serves as a quick hands-on guide and tutorial to the most useful HDFS commands for managing HDFS files from the command line.
November 24, 2016
by Tim Spann DZone Core CORE
· 38,739 Views · 5 Likes
article thumbnail
A Post-Processor for Spring Boot
Learn how to make your own post-processor for your Spring Boot needs, allowing you to add to your environment with ease.
November 23, 2016
by Nicolas Fränkel
· 26,792 Views · 7 Likes
article thumbnail
Get to Know Netflix's Zuul
Here's a look at what Zuul can offer your applications, ranging from authentication and security to routing to resiliency and more.
November 22, 2016
by Rafael Salerno
· 86,440 Views · 19 Likes
article thumbnail
Why Do Microservices Need an API Gateway?
With the growth of API-centric IT initiatives, API gateways and management layers are common place. Should we consider an API gateway for microservices?
November 20, 2016
by James Higginbotham
· 28,525 Views · 16 Likes
article thumbnail
Tracing in Microservices With Spring Cloud Sleuth
Follow along to gain some insight into tracing requests that span multiple microservices in the Spring Cloud ecosystem.
November 18, 2016
by Ryan Baxter
· 110,487 Views · 21 Likes
article thumbnail
How to Design With Conway’s Law in Mind
Gene Kim explains Conway's Law, how to evaluate organizational archetypes, and how to develop the necessary habits to facilitate these structures.
November 16, 2016
by Gene Kim
· 11,004 Views · 3 Likes
  • Previous
  • ...
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×