artur, Does it take a long time on each request or only the first? If only the first, then you could trigger all the scripts after deployment (thought this is not ideal). I am no groovy expert, but even a few seconds to compile the script is too long.
Ray On Wed, 2023-12-13 at 02:55 -0800, artur miś wrote: Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information. > Where does the additional metadata come from : We have added it in groovy staticly for checking purposes . > You could put a timer around each statement in the script to see which one(s) > takes a long time Ray: 11ms but : I have found out that problem coming from groove just before executing script : 2023-12-13 08:10:50,698 TRACE [org.apereo.cas.util.scripting.ScriptingUtils] - <Creating groovy object instance from class [/etc/cas/config/custom-attr.groovy]> And this creation takes 5sec for very basic script . Of course if you add somthing what colecting metadata this time rise up to 10 sec. This that 5 sec is too much . We observed too that for dockerized cas creating groovy object instance for basic script takes 10 sec but mor advanced scenario 15sec. Startup without Contenetization ./gradlew clean build ./gradlew CopyCasConfiguration ./gradlew run Start up with contenerization docker start etc/itd how to reproduce this: 1) cas.properties cas.authn.accept.enabled=true cas.authn.accept.order=1 cas.authn.accept.users=test::test123 cas.authn.accept.name=Static Credentials cas.authn.attribute-repository.groovy[0].location=file:/etc/cas/config/custom-attr.groovy logging.level.org.apereo.cas=TRACE 2) /etc/cas/config/custom-attr.groovy (default documentation script) import java.util.* def run(final Object... args) { def (username,attributes,logger,properties,appContext) = args def startTime = System.currentTimeMillis() logger.debug("[{}]: The received uid is [{}]", this.class.simpleName, username) def result = [username:[username], likes:["cheese", "food"], id:[1234,2,3,4,5], another:["attribute"]] < - aditional metadata comming from this script/line not from other sophisticated resources . In production we have other ldaps etc but not here, becouse we have discovered posibilile problems here so we simplified case . def stopTime = System.currentTimeMillis() def executionTime = stopTime - startTime logger.debug("Czas wykonania skryptu to: ${executionTime} ms") return result } 3) start cas and login as test/test123 few times logs: 2023-12-13 08:10:50,698 TRACE [org.apereo.cas.util.scripting.ScriptingUtils] - <Creating groovy object instance from class [/etc/cas/config/custom-attr.groovy]> commment: lag 9 seconds (creating groovy object) 2023-12-13 08:10:59,307 TRACE [org.apereo.cas.util.scripting.ScriptingUtils] - <Executing groovy script's [run] method, with parameters [[test, {principal=[test], credentialId=[test], credentialClass=[UsernamePasswordCredential], username=[test]}...> commment: script run in 11ms 2023-12-13 08:10:59,318 DEBUG [org.apereo.cas.authentication.principal.resolvers.InternalGroovyScriptDao] - <Groovy-based attributes found are [{username=[test], likes=[cheese, food], id=[1234, 2, 3, 4, 5], another=[attribute]}]> wtorek, 12 grudnia 2023 o 19:12:55 UTC+1 Ray Bon napisał(a): artur, Where does the additional metadata come from? That script looks very basic. You could put a timer around each statement in the script to see which one(s) takes a long time. Ray On Tue, 2023-12-12 at 02:19 -0800, artur miś wrote: Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information. Buddys i atached some more information : I have got problem with long execution time of basic groovy script: cas.authn.attribute-repository.groovy[0].location=file:/etc/cas/config/custom-attr.groovy import java.util.* import java.text.SimpleDateFormat import groovy.transform.Field import javax.naming.directory.* import java.util.Hashtable import javax.naming.* @Field File file = new File("/etc/cas/config/groovy_logs.txt") def run(final Object... args) { def (username,attributes,logger,properties,appContext) = args logger.debug("[{}]: The received uid is [{}]", this.class.simpleName, username) file.append "\n login: "+args[0]+" cas-id:"+args[1]['principal']+"\n" file.append "\n version groove: "+GroovySystem.version+"\n" // All attribute values must be defined as a collection wrapped in [] return [username:[username], likes:["6cheese", "7food"], id:[1234,2,3,4,5], another:["attribute"] ] println GroovySystem.version } System CAS: CAS Version: 7.0.0-RC9 CAS Branch: master CAS Commit Id: xxxxxxxxxxx CAS Build Date/Time: 2023-11-25T07:12:15.881468Z Spring Boot Version: 3.2.0 Spring Version: 6.1.0 Java Home: /usr/lib/jvm/zulu21-ca-amd64 Java Vendor: Azul Systems, Inc. Java Version: 21.0.1 Servlet Version: 6.0.0 JVM Free Memory: 345 MB JVM Maximum Memory: 4 GB JVM Total Memory: 512 MB OS Architecture: amd64 OS Name: Linux OS Version: 5.4.0-167-generic OS Date/Time: 2023-12-12T10:35:50.786113719 OS Temp Directory: /tmp Logs: 2023-12-12 10:41:41,731 DEBUG [org.apereo.cas.authentication.attribute.PrincipalAttributeRepositoryFetcher] - <Fetching person attributes for query [{principal=xxxxxx data xxxxxxx}]> no activity in the log (just waiting ) 2023-12-12 10:41:55,497 DEBUG [org.apereo.cas.authentication.principal.resolvers.InternalGroovyScriptDao] - <[custom-attr]: The received uid is [christmas_banny]> 2023-12-12 10:41:55,497 DEBUG [org.apereo.cas.authentication.principal.resolvers.InternalGroovyScriptDao] - <Groovy-based attributes found are [{username=[christmas_banny], likes=[6cheese, 7food], id=[1234, 2, 3, 4, 5], another=[attribute]}]> This problem has ocured only when we atached groovy without groovy authentication work smoth. Groovy is slow or wait but after let say 15sek returned additional metadata.What is the problem or where find out solution ? środa, 6 grudnia 2023 o 17:02:45 UTC+1 artur miś napisał(a): Hello, Have you noticed that groovy 4.0.15 is slow ? I have hached to 4.0.16 and the same . Regards -- - Website: https://apereo.github.io/cas - Gitter Chatroom: https://gitter.im/apereo/cas - List Guidelines: https://goo.gl/1VRrw7 - Contributions: https://goo.gl/mh7qDG --- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscr...@apereo.org. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/4022524a9a9f927c6ea830fa2cc888ba94c62c46.camel%40uvic.ca.