Project

General

Profile

Inconsistent behavior with HTTP Rest API

Kulshreshth Dhiman
Added almost 4 years ago

Hi,

We have written a groovy script to determine availability of users (online/offline) and we are using HTTP Api to get the user(s) status. Sometimes (1/20) we get response different then expected, possibly response of a completely different request. Note that we have ~200 requests per second. So,

  1. Is there some issue with our script?

  2. Is there concurrency issue in using script?

  3. Can there be some packet ordering problem?

Kindly provide some insight on how does the http server communicates with xmpp server to access users_session/session manager and how can we fix this problem.

Thanks

Kulshreshth

P.S. We are using tigase 5.2.3 version

UsersStatus.groovy (4.29 KB) UsersStatus.groovy Groovy Script
response.txt (1.77 KB) response.txt Correct and Incorrect response

Replies (1)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam almost 4 years ago

It can be any of the issues you listed, we would have to investigate it closely to make sure.

However, I think your approach to the subject is very inefficient. HTTP calls are quite slow and inefficient "by design". HTTP was simply designed for a different purpose and does not work well for tasks like this. My suggestion is to use a different method to collect user's online status. The best option which comes to my mind is to configure presence packets forwarding to some selected JID, connect a bot on this JID and this way collect all user's presences in real time. This would be much faster and much less resource consuming.

  1. http://docs.tigase.org/tigase-server/snapshot/Properties_Guide/webhelp/vhostPresenceForwardJid.html

    (1-1/1)