Federation: Efficiency Improvements
- don't send superfluous activities (i.e. update does not affect receiver)
- in receiver don't spend longer than necessary finding out nothing needs to be done
Related issues
- #249 (closed) Activity Queue (avoids sending duplicate updates)
- #228 saves loop execution (searching for object_model) on receiver methods
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Calum Mackervoy changed time estimate to 2h
changed time estimate to 2h
- Calum Mackervoy mentioned in issue management/core-team#3
mentioned in issue management/core-team#3
- Benoit Alessandroni mentioned in issue #249 (closed)
mentioned in issue #249 (closed)
- Calum Mackervoy changed the description
changed the description
- Calum Mackervoy changed the description
changed the description
- Calum Mackervoy changed the description
changed the description
- Calum Mackervoy changed title from Federation: don't send more activities than necessary to Federation: Efficiency Improvements
changed title from Federation: don't send more activities than necessary to Federation: Efficiency Improvements
- Calum Mackervoy marked the checklist item in receiver don't spend longer than necessary finding out nothing needs to be done as completed
marked the checklist item in receiver don't spend longer than necessary finding out nothing needs to be done as completed
- Author Maintainer
The remaining task on this issue is that bandwidth usage could be reduced if the sender is able to know when an update will affect the receiver
For example if I do this:
cm = CircleMember.objects.create(user=distant_u, circle=local_circle) cm.save() cm.save()
it will result in a two Update activities, one for each
cm.save()
Alternatively the sender could parse through the content of sent activity(s) to check if content has already been delivered (#249 (closed) ) before sending.
This would be O(N) to the number of activities which are parsed, although it could be limited drastically by checking only those sent to the target inbox, within some time frame.EDIT: I've thought of an O(1) solution which may be a lot simpler:
old_activity = get_most_recent_delivered_activity(target, activity_type) new_activity = build_activity(object, target) if no_new_changes(old_activity, new_activity): # no need to send an activity return send_activity(new_activity)
no_new_changes
would require parsing the activity body into JSON and comparing theold_activity.object
state to thenew_activity.object
I also considered storing past state of the model in the database but I don't think it makes sense because it implies nothing about the receiver
Edited by Calum Mackervoy Collapse replies - Owner
Each check would require parsing the activity body into JSON
You could use an upper tailored layer that will have
target
andresource
field and an unique. - Author Maintainer
I don't follow?
The activity could for example be an update on circle owner, serialized roughly like so:
old_activity = { '@id': 'https://circle-id', 'owner': { '@id': 'https://distant-user' } }
I think I've thought of an improvement on my initial design, I've edited my comment above with an explanation
- Owner
You mean that you save every things that change on a json? Because you can have two time the same activity, but to two or more different recipients.
- Please register or sign in to reply
- Calum Mackervoy marked the checklist item don't send superfluous activities (i.e. update does not affect receiver) as completed
marked the checklist item don't send superfluous activities (i.e. update does not affect receiver) as completed
- Calum Mackervoy mentioned in merge request !160 (merged)
mentioned in merge request !160 (merged)
- Jean-Baptiste Pasquier mentioned in commit e94ea652
mentioned in commit e94ea652
- Jean-Baptiste Pasquier closed via merge request !160 (merged)
closed via merge request !160 (merged)