I'm developing a Spring Boot java application. Currently it is a monolith with the rest API and the front end (vaadin driven) in the same big project.
Although this is very easy to develop and deploy, it is getting harder and harder to add features. There are too many concerns in the same application.
Also, I did some load testing on my app and it didn't survive more than ~1.5k (virtual) users using it during 1 minute (+/- 1000 to 4000 requests/s).
What I have researched already
I've been reading about microservices for scaling but I'd have to re-write almost the entire application for that, since all my data is relational and stored in a relational database (and I have no clue on how to change that to independent data).
What I tried to do now is to split the project into three sub projects. A data project that contains all domain and services, an API project that contains the REST api, and a internal front-end project that contains the vaadin interal frontend.
The data project would only be a library for the other projects. The API project and the frontend project would both include this data project in their gradle, and both would use this project as a library to access the database.
Splitting this project is beeing quite hard and I don't even know if this is the correct path to follow. So in this case, is splitting a correct decision?
My thought process was that once the projects are split I could develop with more ease, and also I could spawn independent API instances and plug them in a load balancer (although all of them would still use the same database).
On the other hand, this split is causing many dependency issues since the original project was Spring boot and the data project is not going to be 'runnable' (so it can't depend on the boot plugin as I read). But this is a question for stackoverflow only if the achitecture is right.
- Is it correct to use a project with both domain and service layer, as a library?
- Is it correct to access the same database with more than one application?
- If not, what is the correct form of acessing data (read and write) from instances of an api project (to load balance)?