How to start a clustered application?

Hello,

I am new to CUBA (from my previous post) and I would like to start right on developing a clustered application. As I can see when creating a bare project with Studio, I get all the application modules - global, core, web, etc. I have read the “scaling” section of the docs but it is unclear to me how to start such a project.

My questions are:

  1. How to I separate the web from the middleware in different servers? Do I need to create two projects? Which components/files go with which tier? (global, core, entities, services, etc.)
  2. If I decide to add more servers in the future, what properties/settings do I need to change?
  3. Can I create many middleware projects running on different ports which I can then call from the web tier?

Thanks in advance!

First of all, you should decide why you need a cluster. CUBA cluster is designed for high availablity and load balancing, not for microservice-like dividing functional modules. It means that from functionality perspective your clusteredc application is a monolith, and is developed in a single project.

  1. How to I separate the web from the middleware in different servers? Do I need to create two projects? Which components/files go with which tier? (global, core, entities, services, etc.)

Just build separate WAR files for middleware and web client using the buildWar task, for example:

task buildWar(type: CubaWarBuilding) {
    appHome = '${app.home}'
    appProperties = ['cuba.automaticDatabaseUpdate': 'true']
    singleWar = false // note this parameter
}

Then deploy these WARs to different servers.

  1. If I decide to add more servers in the future, what properties/settings do I need to change?

If you add servers of the web tier, you don’t have to configure any CUBA-specific parameters, just your load balancer. Web servers don’t communicate with each other and don’t share any data, they just request the middleware.

If you add middleware servers, you have to configure CUBA cluster for them as explained in Setting up a Middleware Cluster documentation.

  1. Can I create many middleware projects running on different ports which I can then call from the web tier?

Please explain what you want to achieve by running “many middleware projects on different ports”?

1 Like

Actually it was one of the reasons why we chose CUBA: two of our requirements were HA and scalability.

Great!

Yes we also have experience with microservices, so we also welcome it if CUBA has that capability?

Thanks again!