Foros de discusión

liferay json services api/jsonws very slow

Eric Soucy, modificado hace 6 años.

liferay json services api/jsonws very slow

Junior Member Mensajes: 65 Fecha de incorporación: 21/01/14 Mensajes recientes
Hello,
when I call the API jsonws I often get very slow response times here is some details


call to /api/jsonws/journalarticle/get-article/group-id/9999/article-id/SOME_CONTENT

//I traced database access (truncated ) and I see

//this takes 2.9 seconds
2 × update User_ set uuid_=?, companyId=?, createDate=?, modifiedDate=?, defaultUser=?, contactId=?, password_=?, passwordEncrypted=?, passwordReset=?, passwordModifiedDate=?, digest=?, reminderQueryQuestion=?, reminderQueryAnswer=?, graceLoginCount=?, screenName=?, emailAddress=?, facebookId=?, ldapServerId=?, openId=?, portraitId=?, languageId=?, timeZoneId=?, greeting=?, comments=?, firstName=?, middleName=?, lastName=?, jobTitle=?, loginDate=?, loginIP=?, lastLoginDate=?, lastLoginIP=?, lastFailedLoginDate=

//this takes 1 second
2 × select userimpl0_.userId as userId363_, userimpl0_.uuid_ as uuid2_363_, userimpl0_.companyId as companyId363_, userimpl0_.createDate as createDate363_, userimpl0_.modifiedDate as modified5_363_, userimpl0_.defaultUser as defaultU6_363_, userimpl0_.contactId as contactId363_, userimpl0_.password_ as password8_363_, userimpl0_.passwordEncrypted as password9_363_, userimpl0_.passwordReset as passwor10_363_, userimpl0_.passwordModifiedDate as passwor11_363_, userimpl0_.digest as digest363_, userimpl0_.reminderQ

//this takes 512 ms
1 × select * from (select *, row_number() over ( order by version414_ DESC) as _page_row_num from (select journalart0_.id_ as id1_414_, journalart0_.uuid_ as uuid2_414_, journalart0_.resourcePrimKey as resource3_414_, journalart0_.groupId as groupId414_, journalart0_.companyId as companyId414_, journalart0_.userId as userId414_, journalart0_.userName as userName414_, journalart0_.createDate as createDate414_, journalart0_.modifiedDate as modified9_414_, journalart0_.folderId as folderId414_, journalart0_.classN


My question is why would a call to /api/jsonws/journalarticle/get-article/ generate :
2 update user, 2 select users and finally 1 select journalarticle
the total exec time of this example is ~5 seconds
I m using liferay 6.2

thank you

Eric Soucy
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: liferay json services api/jsonws very slow

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hi Eric,

This is totally a guess on my part but I'll throw it out there -- is it possible that you have model listeners, or service wrappers in one or more of your plugin projects that are performing these operations? Record updates would make sense to record for example a view counter increment on the article, but not through the User query. If you have no active session and are using some kind of auto-SSO (like windows tokens?) then the user updates would make sense in terms of updating the last login date/time, before the record is fetched.

.. I guess the easiest test would be to remove all of your custom plugins, login as the admin, and the use the /jsonws/api endpoint with your articleId to to the same operation and see how long it takes. If it takes less time, then it would see to indicate that perhaps something in the custom code (not the core portal) is causing the issue.

For what it is worth, I have used this service several times in several different environments under all sorts of load scenarios and I have never seen it take that long. I've never timed it, but that is because it has never been slow to respond.