Edit on GitHub!

Technology Choices

The right technology choices are key to a good project.

Current Technology Choices

Current technology choices

Database

These Databases are evaluated:

Checks for determining database

Document vs Relational Database

There are basically two types of databases: Relational and No-SQL databases. When to choose one or another can be found on Microsoft.com.

PostgreSQL

Homepage: https://www.postgresql.org/

Pros

Cons

CouchDB

Homepage: https://couchdb.apache.org/

Pros

Cons

BaseX

Homepage: https://basex.org/

Pros

Cons

eXist-db

Homepage: http://exist-db.org/exist/apps/homepage/index.html

Pros

Cons

Final decision

I prefer eXist-db as the database/register for our XML data (based on what we need). It’s an open source, cross-platform native XML database with an active community and all the functionality we are looking for.

A second option is using PostgreSQL. A stable, open source RDBMS which can also handle XML using the XMLTABLE functionality. But because it’s not the native functionality of PostgreSQL (handling XML), I prefer a native XML database like eXist-db.

My only concern is the maturity of eXist-db. I can’t find good use cases of eXist-db, and I’m not sure of the stability in production for example. Let me know if someone knows some use cases, or maybe someone has experience with eXist-db.

Licensing problems

After discussing database choices within Alliander, eXist is indeed an option, but the license could be a problem. BaseX can do the same as eXist-db (as it seems) and has a better license for our situation (BSD). Also, because the idea is to have an abstract interface layer between CoMPAS and the database, people can also choose to use a different database in the future.

Is it bad BaseX doesn’t have versioning out of the box?

Because BaseX doesn’t have versioning out of the box, I mailed the BaseX community about this issue. The quoted response:

The existing modules of BaseX don’t provide a ready solution for versioning features, but it’s perfectly feasible to build a versioning solution with XQuery. If you use RESTXQ for storing and retrieving data, you could e.g. move the current version of documents to an archive database and replace it with the incoming new document.

Which is fine, a second running database isn’t a problem because it’s a pretty light-weight database.

XML Processing

Checks for determining XML processing

RiseClipse

Pros

Cons

Schematron

Pros

Cons

Final decision

My advice would be to use Schematron (in combination with an XSLT processor) as the XML processing tool. It can do what RiseClipse can do, and more (like suggesting XML fixes and it’s more flexible because it works with native XML technologies). Plus, it works in combination with eXist-db.

Examples: https://en.wikibooks.org/wiki/XQuery/Validation_with_Schematron#Setup_in_eXist-db

https://exist-db.org/exist/apps/doc/validation

https://github.com/Schematron/schematron-exist

RiseClipse is also a good candidate, because it’s dedicated on IEC 61850/CIM validation. Only thing is, it’s not as flexible as using Schematron. But I really do like the combination Schematron and eXist-db/BaseX.

Microservice technology

A good technology is key to a good microservice.

But be aware: it’s not a definitive technology. Multiple microservices can have multiple technologies, that’s the cool thing about microservices. Just create them and put them in a microservice which lives next to the other ones. By using a REST API, it can communicate with the other ones for example.

Checks for determining microservice technology

Quarkus

https://quarkus.io/

Pros

Cons

Java Spring

https://github.com/spring-projects/spring-framework

Pros

Cons

Go Micro

https://github.com/micro/micro

Pros

Cons

Python Flask

https://github.com/pallets/flask

Pros

Cons

NestJS w/ NodeJS

https://github.com/nestjs/nest

Pros

Cons

Final decision

Python Flask en Java Spring are very close and can both be used for our purposes.

It’s an advantage that there is more Java Spring experience compared to Python Flask, so the suggestion is to use Java Spring. Also based on the checks I made. Rob also made a Minimal Viable Product of a microservice using Java Spring and BaseX, which was very quick to setup and works very well.

NestJS also looks very promising, but the lack of documentation is a game changer for me. Go Micro is also a good candidate, but the lack a maturity made me decide not to choose for Go Micro.

When looking at the memory usage (and response times) of Quarkus, it’s definitely interesting for us. Also take a look at this comparison with Java Spring

Because CoMPAS is an application which also should run locally, memory usage is an important aspect. Together with being a modern microservice framework, backed by RedHat and being a Java framework (which we are having experience with) it’s the best choice for now!