October 24, 2018

Bulkhead and Backpressure Pattern with Java EE 7

What is Bulkhead Pattern?

https://en.wikipedia.org/wiki/Bulkhead_(partition)

"Isolate elements of an application into pools so that if one fails, the others will continue to function.
This pattern is named Bulkhead because it resembles the sectioned partitions of a ship's hull. If the hull of a ship is compromised, only the damaged section fills with water, which prevents the ship from sinking."

https://docs.microsoft.com/en-us/azure/architecture/patterns/bulkhead

What is Backpressure Pattern?

Backpressure is about sending good information back to your users that your application is under heavy load and cannot fulfill it's SLA.

https://mechanical-sympathy.blogspot.com/search?q=applying+back+pressure+when+overloaded

Java EE 7 Bulkhead and Backpressure Implementation

https://blog.sebastian-daschner.com/entries/bulkheads-backpressure-javaee

https://github.com/AdamBien/porcupine

Circuit Breaker Pattern with Java EE 7

What is Circuit Breaker Pattern?

It is fail fast (and in a controlled way, with good error and logging message), when your application is under load. If your application does not handle load gracefully, your application will continue to accept incoming request and that makes performance of your application worse, but more important makes the response time even worse for the connecting clients.

"Handle faults that might take a variable amount of time to recover from, when connecting to a remote service or resource. This can improve the stability and resiliency of an application."

https://docs.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker

Java EE 7 Circuit Breaker Implementation


@Singleton
@Interceptors(Breakr.class)
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class Brittle {

    @IgnoreCallsWhen(failures = 2,slowerThanMillis = 10)
    public void unstableAndSlow(){
    }

    @CloseCircuit
    public void reset() {}
}

http://www.adam-bien.com/roller/abien/entry/a_6kb_circuit_breaker_for

October 22, 2018

Applet and Java Web Start is Dead in Java 11

Read morehttps://www.oracle.com/technetwork/java/javase/eol-135779.html.

Oracle JDK for Windows is Not Free Anymore

Oracle JDK

Starting from Januari 2019 you need to pay Oracle to use Oracle Java 8 in production. Downloading and using Oracle Java 8 for developing and testing is fine.

"Oracle Customers. Oracle Customers are those Oracle customers with an active (1) Java SE Subscription and/or Java SE Desktop Subscription, (2) support contract for Oracle Java SE Advanced, Oracle Java SE Advanced Desktop, Oracle Java SE Suite, and/or Java SE Support, or (3) Java SE support entitlement for use of Java SE solely with another Oracle product (Visit My.Oracle Support Note 1439822.1 - All Java SE Downloads on MOS – Requires Support Login)."
"Commercial Users. Commercial Users are entities other than Oracle Customers that use Java SE for business, commercial or production purposes as part of a Java application delivered by a third party or developed internally."
"Personal Users. Personal Users are individuals who use Java SE on personal desktops or laptops. Personal users include individuals using Oracle Java SE to develop applications for hobby or educational purposes, play games or run consumer productivity applications."

To read more https://www.oracle.com/technetwork/java/javase/eol-135779.html

And also https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later

OpenJDK for Linux

If you running Linux already, you are also probably also already running OpenJDK, otherwise start use OpenJDK instead of Oracle Java. OpenJDK is natively packaged for Linux so only search for install software on your Linux distro.

To read more https://openjdk.java.net/

But things are also changing for OpenJDK, Oracle wants to skip LTS for OpenJDK and deliver new Major versions every 6 months!

But Red Hat will deliver a OpenJDK 11 LTS for RHEL, https://access.redhat.com/articles/3409141

See also https://access.redhat.com/solutions/3116731.

And Red Hat will deliver this LTS version for Windows as well, but only for Developing purpose https://developers.redhat.com/products/openjdk/download/.

About Red Hat support for OpenJDK 7, 8 and 11 on RHEL platform.

"In addition to distributing and providing lifecycle support for OpenJDK on Red Hat Enterprise Linux, Red Hat’s open source Java middleware products support OpenJDK for Red Hat Enterprise Linux, enabling users to get a full stack support from the operating system through to application services from a single vendor, and other Red Hat products internally run on OpenJDK. We are a leader in offering support to customers worldwide that rely on open source to run their production workloads."

https://www.redhat.com/en/blog/history-and-future-openjdk

Java Microservice Framework

What is a Microservice?

There are no clear definition, but it is like "fine grained SOA".

Why Microservice?

  • "Improves modularity and makes the application easier to understand, develop, and test."
  • "It parallelizes development by enabling small autonomous teams to develop, deploy and scale their respective services independently."
  • Easier to refactor a small part, instead of a monolithic system.

Why not Microservice?

  • "Services form information barriers."
  • "Inter-service calls over a network have a higher cost in terms of network latency and message processing time than in-process calls within a monolithic service process."
  • "Testing and deployment are more complicated."
  • "Moving responsibilities between services is more difficult.[1] It may involve communication between different teams, rewriting the functionality in another language or fitting it into a different infrastructure"
  • "Viewing the size of services as the primary structuring mechanism can lead to too many services when the alternative of internal modularization may lead to a simpler design."

Read more https://en.wikipedia.org/wiki/Microservices.

Examples of Java Microservice Framework

  • Javalin
  • Spark Java
  • Micronaut
  • Ktor
  • Ktor
  • Jooby
  • Akka HTTP
  • Dropwizard
  • Jodd
  • Armeria

Read more https://www.e4developer.com/2018/06/02/the-rise-of-java-microframeworks/.

Servless/Function-as-a-service, FaaS

What is Serverless/Function-as-a-service, FaaS?

First, it does not mean, you don't need a Server, instead it means, that the developer should focus on the code and not the server.

Also it all about going to the cloud, and that you don't want to worry about running servers, their storage, etc.

Examples of functions:

  • Create person.
  • Search person.
  • Update person.

Read more about at https://serverless.com/learn/overview.

Examples of serverless providers

  • Amazon Web Service, AWS
  • Microsoft Azure
  • IBM OpenWhisk
  • Google Could Platform
  • Kubeless
  • spotinst
  • Oracle fn
  • Cloudflare

Read more about at https://serverless.com/framework/docs/getting-started/.

July 27, 2018

How to Install PyDev, Free Eclipse Based Python Editor

Introduction

PyDev is a free Python Editor based on Eclipse. See http://www.pydev.org/.

Prerequisite

  1. Install Python - Download Python.
  2. Install Java 8 - Download Java SE.
  3. Download Eclipse 4.6 (Neon) - Download Eclipse 4.6 (Neon).

After installing Python and Java, unzip Eclipse zip file to a new directory.

Installation PyDev

Click Help > Install New Software... and enter select PyDev for Eclipse.

Then Next, Accept License Agreement, Finish and when requested to Restart, restart.

Configuration PyDev

Click Window > Preferences > PyDev > Interpreter and set python home.

Test PyDev

Click File > New > Project > PyDev > PyDev project and fillout.

Then create a new Python Module. First select your new python project then File > New > Other and select Python Module.

Then enter a Name for the class and optionally a package name.

Finally select Module Main

Write some simple code


if __name__ == '__main__':
    print("Hello World!")

Then to run press Ctrl + F11 or from the menu Run > Run.

Happy Python coding!