Page MenuHomePhabricator

New Service Request for Trending Edits Service
Closed, ResolvedPublic

Description

About

See parent ticket here: T140102
Endpoint path under discussion here: T150039

This is a request to deploy a Trending Edits Service. We hope to have the initial deployment by November 30th prior to the holidays. We realize the schedule is tight, so any help with this is greatly appreciated.

This service provides a list of pages that are currently trending through an algorithm that analyzes the rate of edits.

Service Architecture

Language

NodeJS

Diagram

TBD

Connection

To process edits in real time, it uses WebSockets (socket.io) to connect to the RC Stream.

Event Collection

Each time an event is received through from the RC Stream, the service runs several checks to exclude changes that aren't relevant to the algorithm (like bot edits, moves, deletions).
From here, each relevant event is counted as an "edit" (Reverts are tracked separately). If the page related to the edit is not currently being tracked, a page object is created and then stored in a hash by the page's id.

In Memory Cache

The page id hash is pruned every 20 seconds to keep the footprint as small as possible. Pages are kept at least 5 minutes, but then must be edited 3 times a minute to stay in the hash. Any page older than 1 day is automatically purged to keep the data fresh.

Persistance

The current prototype uses levelDB for persistence of changes, but this will be removed before production. For initial deployment the service will not persist any data and instead use only memory. Persistence may eventually be re-added if needed, but may be obviated if the service moves to using Kafka where it can replay events as needed.

API

When the trending API is called, it first checks for a cached response and then recalculates if necessary. It calculates a score based on several factors such as edits, reverts, anonymous edits, number of contributors, and views. The algorithm itself is still being tweaked to find a good balance of surfacing trending articles.

Projects

Currently the project only processes events for the English Wikipedia. The current algorithm only sees a enough events on high traffic pages. After the initial testing phase for EN, we will be exploring options to expand to other wikis.

Service Info

OwnerReading Mobile-Content-Service
Contact person@bearND / @Jdlrobson / @Fjalapeno
TimelineNovember 30, 2016
Source codetrending-edits
Prototype codeweekipedia, wikitrender
Labs Prototypetrending-edits-api, trending-edits-ui
Target clusterSCB

Event Timeline

Fjalapeno updated the task description. (Show Details)
Fjalapeno updated the task description. (Show Details)

Change 320395 had a related patch set uploaded (by Mobrovac):
Initial import of trending-edits

https://gerrit.wikimedia.org/r/320395

Change 320395 merged by Mobrovac:
Initial import of trending-edits

https://gerrit.wikimedia.org/r/320395

Change 320630 had a related patch set uploaded (by Mobrovac):
Add Scap3 Configuration

https://gerrit.wikimedia.org/r/320630

Change 320630 merged by Mobrovac:
Add Scap3 Configuration

https://gerrit.wikimedia.org/r/320630

Change 323194 had a related patch set uploaded (by Mobrovac):
Trending Edits: Role and module

https://gerrit.wikimedia.org/r/323194

Change 323194 merged by Alexandros Kosiaris:
Trending Edits: Role and module

https://gerrit.wikimedia.org/r/323194

Change 326527 had a related patch set uploaded (by Mobrovac):
Trending Edits: Add to SCB

https://gerrit.wikimedia.org/r/326527

Change 326528 had a related patch set uploaded (by Mobrovac):
Trending Edits: LVS configuration

https://gerrit.wikimedia.org/r/326528

Change 326529 had a related patch set uploaded (by Mobrovac):
RESTBase: Add trending edits service config portion

https://gerrit.wikimedia.org/r/326529

Change 326527 merged by Alexandros Kosiaris:
Trending Edits: Add to SCB

https://gerrit.wikimedia.org/r/326527

Change 326933 had a related patch set uploaded (by Alexandros Kosiaris):
Allocate LVS IPs for trendingedits service

https://gerrit.wikimedia.org/r/326933

Change 326933 merged by Alexandros Kosiaris:
Allocate LVS IPs for trendingedits service

https://gerrit.wikimedia.org/r/326933

Change 326528 merged by Alexandros Kosiaris:
Trending Edits: LVS configuration

https://gerrit.wikimedia.org/r/326528

Change 326529 merged by Alexandros Kosiaris:
RESTBase: Add trending edits service config portion

https://gerrit.wikimedia.org/r/326529

mobrovac moved this task from Inbox to In progress on the Service-deployment-requests board.

The service is fully in production, time to resolve this ticket.