mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
MNT-21514 ACS-22: Added new secondary cache map to avoid performance bottleneck in InMe… (#949)
* Added new secondary cache map to avoid performance bottleneck in InMemoryTicketComponent in clustered environment * Fixed AuthenticationTest * Change line separators back
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -36,7 +36,7 @@
|
||||
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
|
||||
<dependency.alfresco-data-model.version>8.50.10</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-data-model.version>8.50.11</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-core.version>7.31</dependency.alfresco-core.version>
|
||||
|
||||
<dependency.alfresco-legacy-lucene.version>6.2</dependency.alfresco-legacy-lucene.version>
|
||||
|
@@ -598,6 +598,9 @@
|
||||
<property name="ticketsCache">
|
||||
<ref bean="ticketsCache" />
|
||||
</property>
|
||||
<property name="usernameKey">
|
||||
<ref bean="usernameKeyCache" />
|
||||
</property>
|
||||
<!-- The period for which tickets are valid in XML duration format. -->
|
||||
<!-- The default is PT1H for one hour. -->
|
||||
<property name="validDuration">
|
||||
|
@@ -280,6 +280,10 @@
|
||||
<bean name="ticketsCache" factory-bean="cacheFactory" factory-method="createCache">
|
||||
<constructor-arg value="cache.ticketsCache"/>
|
||||
</bean>
|
||||
|
||||
<bean name="usernameKeyCache" factory-bean="cacheFactory" factory-method="createCache">
|
||||
<constructor-arg value="cache.usernameKeyCache"/>
|
||||
</bean>
|
||||
|
||||
<!-- ===================================== -->
|
||||
<!-- WebServices Query Session Cache -->
|
||||
|
@@ -333,6 +333,15 @@ cache.ticketsCache.eviction-policy=LRU
|
||||
cache.ticketsCache.merge-policy=com.hazelcast.map.merge.PutIfAbsentMapMergePolicy
|
||||
cache.ticketsCache.readBackupData=false
|
||||
|
||||
cache.usernameKeyCache.maxItems=1000
|
||||
cache.usernameKeyCache.timeToLiveSeconds=0
|
||||
cache.usernameKeyCache.maxIdleSeconds=0
|
||||
cache.usernameKeyCache.cluster.type=fully-distributed
|
||||
cache.usernameKeyCache.backup-count=1
|
||||
cache.usernameKeyCache.eviction-policy=LRU
|
||||
cache.usernameKeyCache.merge-policy=com.hazelcast.map.merge.PutIfAbsentMapMergePolicy
|
||||
cache.usernameKeyCache.readBackupData=false
|
||||
|
||||
cache.authorityEntitySharedCache.tx.maxItems=50000
|
||||
cache.authorityEntitySharedCache.tx.statsEnabled=${caches.tx.statsEnabled}
|
||||
|
||||
|
@@ -103,6 +103,7 @@ public class AuthenticationTest extends TestCase
|
||||
private AuthenticationManager authenticationManager;
|
||||
private TicketComponent ticketComponent;
|
||||
private SimpleCache<String, Ticket> ticketsCache;
|
||||
private SimpleCache<String, String> usernameKey;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private MutableAuthenticationService pubAuthenticationService;
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
@@ -173,6 +174,7 @@ public class AuthenticationTest extends TestCase
|
||||
// permissionServiceSPI = (PermissionServiceSPI)
|
||||
// ctx.getBean("permissionService");
|
||||
ticketsCache = (SimpleCache<String, Ticket>) ctx.getBean("ticketsCache");
|
||||
usernameKey = (SimpleCache<String, String>) ctx.getBean("usernameKeyCache");
|
||||
|
||||
ChildApplicationContextFactory sysAdminSubsystem = (ChildApplicationContextFactory) ctx.getBean("sysAdmin");
|
||||
assertNotNull("sysAdminSubsystem", sysAdminSubsystem);
|
||||
@@ -845,6 +847,7 @@ public class AuthenticationTest extends TestCase
|
||||
tc.setTicketsExpire(false);
|
||||
tc.setValidDuration("P0D");
|
||||
tc.setTicketsCache(ticketsCache);
|
||||
tc.setUsernameKey(usernameKey);
|
||||
|
||||
dao.createUser("Andy", "ticket".toCharArray());
|
||||
|
||||
@@ -871,6 +874,7 @@ public class AuthenticationTest extends TestCase
|
||||
tc.setTicketsExpire(false);
|
||||
tc.setValidDuration("P0D");
|
||||
tc.setTicketsCache(ticketsCache);
|
||||
tc.setUsernameKey(usernameKey);
|
||||
|
||||
dao.createUser("Andy", "ticket".toCharArray());
|
||||
|
||||
@@ -900,12 +904,14 @@ public class AuthenticationTest extends TestCase
|
||||
public void testTicketExpiryMode()
|
||||
{
|
||||
ticketsCache.clear();
|
||||
usernameKey.clear();
|
||||
|
||||
InMemoryTicketComponentImpl tc = new InMemoryTicketComponentImpl();
|
||||
tc.setOneOff(false);
|
||||
tc.setTicketsExpire(true);
|
||||
tc.setValidDuration("P5S");
|
||||
tc.setTicketsCache(ticketsCache);
|
||||
tc.setUsernameKey(usernameKey);
|
||||
tc.setExpiryMode(ExpiryMode.AFTER_FIXED_TIME.toString());
|
||||
|
||||
dao.createUser("Andy", "ticket".toCharArray());
|
||||
@@ -1043,11 +1049,13 @@ public class AuthenticationTest extends TestCase
|
||||
public void testTicketExpires()
|
||||
{
|
||||
ticketsCache.clear();
|
||||
usernameKey.clear();
|
||||
InMemoryTicketComponentImpl tc = new InMemoryTicketComponentImpl();
|
||||
tc.setOneOff(false);
|
||||
tc.setTicketsExpire(true);
|
||||
tc.setValidDuration("P5S");
|
||||
tc.setTicketsCache(ticketsCache);
|
||||
tc.setUsernameKey(usernameKey);
|
||||
|
||||
dao.createUser("Andy", "ticket".toCharArray());
|
||||
|
||||
@@ -1141,6 +1149,7 @@ public class AuthenticationTest extends TestCase
|
||||
tc.setTicketsExpire(true);
|
||||
tc.setValidDuration("P1D");
|
||||
tc.setTicketsCache(ticketsCache);
|
||||
tc.setUsernameKey(usernameKey);
|
||||
|
||||
dao.createUser("Andy", "ticket".toCharArray());
|
||||
|
||||
|
Reference in New Issue
Block a user