cancel
Showing results for 
Search instead for 
Did you mean: 

WebScript Performance Issues

jpfi
Champ in-the-making
Champ in-the-making
Hi,
I'm currently evaluating to implement a few WebScript to use Alfresco as a content archive. I've started with a createDoc-Script using javascript with gets an multipart/form-data request sets some attributes and stores the file. An short performance test (Enterprise 2.1, MySql) shows that my script takes overall 200-300ms (filesize 5KB), that is to slow for my requirements.
So, is there any approach to speed up this.
E.g. is a java-backed WebScripts faster than a javascript backed Script?
if true, can java-backed WebScripts handle multipart/form-data request, I didn't find any method regarding this purpose in the WebScriptRequest class?

Thanks for helping,
Jan
2 REPLIES 2

davidc
Star Contributor
Star Contributor
Is your timing for the round-trip, server only processing or something else?

Is that after executing the script a few times (to warm up script/template cache)?

Have you switched on web script debug logging to see how long each of the web script components take e.g. javascript execution, template execution etc

You can switch to Java-backed - if you know you're executing in the servlet environment, the WebScriptRequest can be cast to a WebScriptServletRequest, which provides access to HTTPServletRequest.

jpfi
Champ in-the-making
Champ in-the-making
Hi David,
thanks for your quick answer.
my first timing is the whole http-roundtrip from clientside.
I'm using Apache HttpClient on clientside:

log.debug("\ncall WebScript start");
         // Execute the method.
         int statusCode = client.executeMethod(method);
         if (statusCode != HttpStatus.SC_OK) {
            throw new DMSException("Alfresco call failed! HTTPStatus: "
                  + method.getStatusText() + "::" + DMSRET_USER);
         }
         log.debug("call WebScript end\n");

The script is executed 50 times. That is the alfreso logging output of one script execution:


11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Processing script url (POST) /de/fme/alfresco/createOrUpdateComponent
11:15:34,217 DEBUG [org.alfresco.web.scripts.DeclarativeWebScriptRegistry] Web Script index lookup for uri /de/fme/alfresco/createOrUpdateComponent took 0ms
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Agent: null
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Format style: extension, Default format: text
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Invoking Web Script de/fme/createComponent.post (unauthenticated)
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Current authentication: unauthenticated
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Authentication required: user
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Guest login: false
11:15:34,217 DEBUG [org.alfresco.web.scripts.BasicHttpAuthenticator] HTTP Authorization provided: false
11:15:34,217 DEBUG [org.alfresco.web.scripts.BasicHttpAuthenticator] URL ticket provided: false
11:15:34,217 DEBUG [org.alfresco.web.scripts.BasicHttpAuthenticator] Requesting authorization credentials
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Authentication reset: unauthenticated
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Web Script de/fme/createComponent.post executed in 0ms
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Processed script url (POST) /de/fme/alfresco/createOrUpdateComponent in 0ms
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptServlet] Processing request (POST) http://localhost:8080/alfresco/service/de/fme/alfresco/createOrUpdateComponent
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Processing script url (POST) /de/fme/alfresco//createOrUpdateComponent
11:15:34,217 DEBUG [org.alfresco.web.scripts.DeclarativeWebScriptRegistry] Web Script index lookup for uri /de/fme/alfresco/createOrUpdateComponent took 0ms
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Agent: null
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Format style: extension, Default format: text
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Invoking Web Script de/fme/createComponent.post (unauthenticated)
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Current authentication: unauthenticated
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Authentication required: user
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Guest login: false
11:15:34,217 DEBUG [org.alfresco.web.scripts.BasicHttpAuthenticator] HTTP Authorization provided: true
11:15:34,217 DEBUG [org.alfresco.web.scripts.BasicHttpAuthenticator] URL ticket provided: false
11:15:34,217 DEBUG [org.alfresco.web.scripts.BasicHttpAuthenticator] Authenticating (BASIC HTTP) user admin
11:15:34,217 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Begin transaction: required
11:15:34,217 DEBUG [org.alfresco.web.scripts.DeclarativeWebScript] Executing script workspace://SpacesStore//Firmen Arbeitsbereich/Daten Verzeichnis/Web Scripts Extensions/de/fme/createComponent.post.js
11:15:34,436 DEBUG [org.alfresco.web.scripts.AbstractWebScript] Executed script workspace://SpacesStore//Firmen Arbeitsbereich/Daten Verzeichnis/Web Scripts Extensions/de/fme/createComponent.post.js in 219ms
11:15:34,436 DEBUG [org.alfresco.web.scripts.WebScriptServletResponse] Cache - set response header Cache-Control: no-cache
11:15:34,436 DEBUG [org.alfresco.web.scripts.WebScriptServletResponse] Cache - set response header Pragma: no-cache
11:15:34,436 DEBUG [org.alfresco.web.scripts.DeclarativeWebScript] Rendering response: content type=text/plain, status=200
11:15:34,436 DEBUG [org.alfresco.web.scripts.DeclarativeWebScript] Rendering template 'de/fme/createComponent.post.text.ftl'
11:15:34,436 DEBUG [org.alfresco.web.scripts.AbstractWebScript] Rendered template de/fme/createComponent.post.text.ftl in 0ms
11:15:34,436 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] End transaction: required
11:15:34,608 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Authentication reset: unauthenticated
11:15:34,608 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Web Script de/fme/createComponent.post executed in 391ms
11:15:34,608 DEBUG [org.alfresco.web.scripts.WebScriptRuntime] Processed script url (POST) /de/fme/alfresco/createOrUpdateComponent in 391ms

so, js-script tooks 219ms, template 0s (it is empty…), ~170ms end transaction.
Warning: this timing was taken on a 2GHz/2GB notebook, but I tried the same on a faster machine, there it is a little bit faster.

Cheers, Jan