Showing posts with label concurrency. Show all posts
Showing posts with label concurrency. Show all posts

Friday, June 03, 2016

Old projects reborn - MoneyTimer

This is another tool, I've tried to update in order to withstand the test of time - MoneyTimer

What does it do ?
It measures time and calculates every second how much time it costed all participants.
Great for consultation meetings!



You can try out the latest release here:

What I can learn from it?
- Java 8 Lambda expressions
- Simple Multi-threaded application
- Swing

How to contribute: 
Check the instructions at the github repo page.
If you are wondering what to contribute: there's a list of ideas in the issues page


Tune in, because more complex ones are coming ...

PS:
Check out my other project that can interest you. This time about HTML generation via XSL transformations - http://javamissionary.blogspot.bg/2016/04/old-projects-reborn-filesystem2html-tool.html

Saturday, August 20, 2011

A diffrent software architecture - LMAX

It was an interesting afternoon to read the article that the famous Martin Fowler had written a month ago.

It's about a different kind of architecture, how it worked and how the software engineers got to that solution of their problems. The project is about processing multiple concurrent orders and the platform had to provide low latency. The team managed to create a system that copes with 6 million transactions per second.
The strange thing is that they do it on a single-threaded application with in-memory database approach (caches).

They have tried other more-conventional approaches like multi-threading and the Actor approach but the performance of the Queue was limiting them, also the need to synchronize threads and interactions between them, context switch at CPU level was drawing performance back.

So they decided to separate input/output and processing into different modules.
Each input event gets unmarshalled and all its required pre-processing (IO operations and credit card verification operations for example) are done before hand and inserted into a the main stream that is processed by the business logic unit.

The team also create special implementations for collection classes so that they use caches better. They processed events not in a Queue approach but with a ring buffer and on it were running several processor modules - one for unmarshalling, one for backup (Journal) and Replicator and finally the Business Logic Processor. They are in a constant race and there are rules that prevent 1 from getting ahead of the other and processing a data field that isn't ready yet. This ring buffer has enormous size (20 million items)

The main idea is that CPU can process fast sequence of operations which are simple (therefore very optimized by the Java compiler), and using in-memory caches (no SQL queries), this could push the performance of a system high.

Also another gain for the team is that they don't have to cope with complex techniques like transactions, inter-thread communications etc...


I think I've just covered the basics of this software architecture approach. If you are interested enough, do visit the original article at -> http://martinfowler.com/articles/lmax.html

Tuesday, October 19, 2010

DevReach 18+19 October Sofia, Bulgaria (part5)

...continued

Designing Applications in the era of Many-core Computing:

This session was about making a unparalleled program use all cores of a CPU.
The presenter was a Romanian so his program was the recipee for making goulash.
He used threading on a higher level with a structure called a Task.
A tasks can be combined to be one after another by a lambda expressions.


Building RESTful Applications with the Open Data Protocol

The last session I attended was one regarding RESTful services.
The presenter was very high-spirited and it was a joy to listen to his explanations.
So REST services is exposing a service to be accessed  via pure URL address through the browser. 
Using the HTTP methods POST GET UPDATE DELETE to access the service if you have the access rights.

He demonstrated how to connect to such a service via a client.

He created an REST service. 
He showed an easy API to do paging for the service.

It was a very nice presentation. 

L.K. 

Saturday, August 28, 2010

Java 5 and Java 6 not so popular features set

Many know about generics, collections enhancements and auto-boxing, varargs, annotations ,but there are some less popular features added to java in Java5 and Java6. I'm going to point the lights on them, because they are little treasures:

Java 5:


- Formatter class - easy to use class for proper formatting of numbers, date-time, currency etc

- Scanner class - slower but comfortable to use to read text from streams

-    java.util.concurrency.* package - atomic classes introduced. You are going to use them if you are in a concurrent environment... Also locks and some thread-safe collections

- JMX was added to J2SE --- instrumentation, management for your applications, MBeans - you name it

- Arrays.fill() -- fills an array with a value you give it. Very useful instead of writing a loop and doing it manually.

- Arrays.deepToString(); --- another great static method -- instead of writing a recursion method to print the toString method of the elements in a multi-dimensional array, you just use this method !

- JTable printing - it looks more natural to have a native printing method



Java 6:

-  Deque --double-ended queue was added as an interface in the collections package

- int[] newArray = Arrays.copyOf(anotherArray, newLength);  --- faster and cooler than System.arraycopy(..)

- drag'n'drop improved --- they made it more usable, but how exactly - I haven't tried it to tell you

- JTable sorting and filtering added

- Console class added

- new methods in File - getTotalSpace(), getFreeSpace(), getUsableSpace() --- why create a file and fill it with some data when you can first check if there is enough space in the drive to create the file in the first place?

- java.util.zip.DeflaterInputStream: Data read from this stream is compressed.
  java.util.zip.InflaterOutputStream: Data written to this stream is decompressed.

Or in normal human language - something like a Zip Streams where data is compressed . Nice! I am sure to use it next time!

- JMX was greatly fixed and update so my suggestion is to use it on this JRE6 version.

- JSR 223: Scripting for the Java™ Platform API -- This is a framework by which Java Applications can "host" script engines


So Java guys, out there, don't miss out these features and have in mind the enhancements :)

L.K.