Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Feature/cluster support with spring session #123

Merged
merged 4 commits into from
Oct 13, 2020

Conversation

IgorNB
Copy link
Contributor

@IgorNB IgorNB commented Oct 11, 2020

Cluster support with spring session added.

  • Before this MR tesler platform in cluster mode produced error (see 2 node scenario)

  • After this MR one can choose any spring-session provider (jdbc, redis and so on) and work in cluster mode (see scenario for tesler-doc exmaple application. Includes configuring spring-session-jdbc and working with 2 nodes)

@codecov
Copy link

codecov bot commented Oct 11, 2020

Codecov Report

Merging #123 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #123   +/-   ##
=========================================
  Coverage     15.45%   15.45%           
  Complexity      473      473           
=========================================
  Files           438      438           
  Lines          8740     8740           
  Branches        832      832           
=========================================
  Hits           1351     1351           
  Misses         7304     7304           
  Partials         85       85           
Impacted Files Coverage Δ Complexity Δ
...c/main/java/io/tesler/core/config/CacheConfig.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ler/core/util/session/impl/SessionServiceImpl.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f51db74...4dea203. Read the comment docs.

@abratashev
Copy link
Member

As I know, BcStateAwareImpl store ClientStorage in session.
ClientStorage is serializable now.
ClientStorage contains collection of BcState, that represent state of current Business component
BcState is also serializable.
But DataResponseDTO, that a part of BcState, isn't serializable.
As long as I remember, spring jdbc does not allow serialize objects, that not implements Serializable interface.
Wouldn't such an implementation lead to an error when trying to create a record on a business component that supports state?

@IgorNB
Copy link
Contributor Author

IgorNB commented Oct 12, 2020

As I know, BcStateAwareImpl store ClientStorage in session.
ClientStorage is serializable now.
ClientStorage contains collection of BcState, that represent state of current Business component
BcState is also serializable.
But DataResponseDTO, that a part of BcState, isn't serializable.
As long as I remember, spring jdbc does not allow serialize objects, that not implements Serializable interface.
Wouldn't such an implementation lead to an error when trying to create a record on a business component that supports state?

It is seems to work fine. Illustrated it at this moment https://youtu.be/2K2jZy6iGpY?t=121

iborisenko added 2 commits October 12, 2020 19:49
…_CACHE which is not scoped to session.

This will give better performance in cluster mode with spring-session-jdbc (<=> no cache, because it stores session data in DB). At the same time for single node mode it will give almost same performance as session scoped cache.

Trade off here is average RAM size for USER_CACHE (elements are not deleted from cache when user logs out), but when all users log-in at the same time, then both session scoped and current caches will require same RAM. So max RAM size is the same.

 In concrete app using tesler and having lots of users one should consider redefining bean
 @primary
 @bean(name = USER_CACHE)
 public Cache sessionCache() {}
 with some cache provider supporting memory limits and auto cache eviction (hazelcast and so on), so USER_CACHE is kept as separate cache from UI_CACHE in this commit
@sonarcloud
Copy link

sonarcloud bot commented Oct 12, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (1.8.0_151) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11.
Read more here

@abratashev abratashev merged commit 3e0bc81 into master Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants