Sunday, July 24, 2016

Microservices mishaps: 1 query, multiple DBs

I want to share my experience with the latest trend in software engineering - microservices.

In particular, I want to explain a case I recently stumbled upon which made us hate the strategy we've got of splitting the big monolithic application to microservices.

The use case is relatively simple - one wants to make a query concerning multiple entities. They have relations between them nevertheless, the data ideally should be owned by separate microservices in an autonomous way.

The example:

Let's say that the product is a ERP-like and naturally we would have entities like company and invoices. Naturally, we'd went for microservice for the company - let's name it company-srv and one for invoices - invoice-srv. Both of these should own the APIs and DB

Now what happens when we want to make a query that is something like:
Get all companies with more than 1000 invoices
or slightly more complex example:
Get all invoices that haven't sent email-report last month for the companies that have this feature enabled.

How do you handle such responsibility - is it in invoice-srv's ownership and it should have a dependency on the other services? How do you keep the performance high with increased row count?

Even if you handle this with additional relations between the 2 DBs between the autonomous services, let's add another more interesting factor to the situations.

The more complex (and quite common) example:

Let's try to intertwine permissions - let's say that the user who is trying to see the results of the above queries, doesn't have permissions for some of the companies? Or even more intriguing - for some of the branches of the companies...

Whose responsibility is it to orchestrate the query? Does it become a multi-query operation? Is there going to be a permissions-srv ? What about performance?  Pagination?

...

All these are questions we ask when we pick microservices. Otherwise, it would have been a simple JOIN in the monolithic approach....

Are we going backwards? :)

PS:
more on the topic this cool post: https://www.javacodegeeks.com/2016/07/hardest-part-microservices-data.html 

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

Friday, April 29, 2016

Old projects reborn - FileSystem2Html tool

As everyone in the IT business, I have quite a few of my own projects. Most of them rot in solitude and are rather dusty... So, I decided as a way of exercise as well as a check how have technologies developed and my own views on code cleanness, tests' quality and overall project usability, to make them more development-friendly.

In short - I'm reviving my projects (both university and personal ones) so that they are easy to setup, run and contribute to if there's a willing person.

I'm starting with this small project: https://github.com/leni-kirilov/FileSystem2Html/

What does it do:

- it's a simple Folder structure scanner
- it can build an HTML/XML report of the folder structure
- it can rebuild that folder structure elsewhere (without the content, obviously)

My "beautiful" swing UI

Very useful if you like a certain folder structure, and don't have the time to remove all the files or whatever. You can easily mimic it. Quite a simple app.

Now to the contribution part:

- It's an open source project 
- Java 8 required
- built with Maven 
- a list of TODOs and ideas where one can get started! I've listed ideas based on effort. 
I would start with the small ones

The project builds automatically and measures code coverage (yes, there are unit tests there!)
(Thank you Travis-CI, Coveralls and Coverity!)

So that's pretty much it.
I can't wait until I see someone energetic about such a tool

Best of wishes!
Leni

PS:
Please be gentle :) I know there's some pretty lame code out there!