You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Wikifeeds

From Wikitech-static
Revision as of 20:38, 24 September 2020 by imported>Mholloway (→‎Contacts)
Jump to navigation Jump to search

Wikifeeds is an API service served via RESTBase. The functionality provided by this was previously part of Mobile content services (MCS).

Contacts

The service is maintained by the Product Infrastructure team, who can be reached in the #wikimedia-infrastructure channel on Freenode.

Primary contacts:

  • Yiannis Giannelos (nemo-yiannis)
  • Bernd Sitzmann (bearND)
  • Mateus Santos (mateusbs17)

Petr Pchelko (Pchelolo) can also help in the case of operational emergencies related to the RESTBase API gateway.

Overview

Wikifeeds is a node.js webservice supporting the Explore feeds in the official Wikipedia Android and iOS apps.

It creates content that is served via the public REST API feed content endpoints (served by RESTBase):

  • /api/rest_v1/feed/featured/{yyyy}/{mm}/{dd}
  • /api/rest_v1/feed/announcements
  • /api/rest_v1/feed/onthisday/{type}/{mm}/{dd}
  • /api/rest_v1/page/random/{format}

See docs on the English Wikipedia: https://en.wikipedia.org/api/rest_v1/#/Feed and https://en.wikipedia.org/api/rest_v1/#/Page%20content/get_page_random__format_.

Some of the responses for these endpoints are consolidated in RESTBase from a larger number of more narrowly focused responses provided by the wikifeeds service.

Technology

Wikifeeds is split off from the main mobileapps/mobile content service. As such it is a nodejs service. It's a service-runner compatible service based on the Node.js service template.

The service is deployed on the WMF services kubernetes cluster using helm. This means that the service is packaged as a docker image. The docker image is built by the Deployment pipeline.

Deployment

The images that are used in production can be found on the WMF docker registry which is missing a nice UI; the easiest way to see current images is this tool. New images are built, after code is merged to the master branch, automatically by the deployment pipeline.

The production clusters are managed using kubernetes and helm. These are also used for a staging instance as well. The configuration for these can be found in the operations/deployment-charts repo. Details for applying those adjustments to the production clusters can be found here.

Architecture

In a nutshell, the service gathers information about featured content from the templates used to display it on various Wikipedias, and provides it in a standard, structured format.

It provides several endpoints which are in turn consumed by RESTBase to compose larger public endpoint responses:

  • For /feed/featured/{yyyy}/{mm}/{dd}:
    • /page/featured/{yyyy}/{mm}/{dd}
    • /media/image/featured/{yyyy}/{mm}/{dd}
    • /page/most-read/{yyyy}/{mm}/{dd}
    • /page/news
    • /feed/onthisday/selected/{mm}/{dd}
  • For /feed/onthisday/all/{mm}{dd}:
    • /feed/onthisday/births/{mm}/{dd}
    • /feed/onthisday/deaths/{mm}/{dd}
    • /feed/onthisday/events/{mm}/{dd}
    • /feed/onthisday/holidays/{mm}/{dd}
    • /feed/onthisday/selected/{mm}/{dd}

These consolidated responses are composed in RESTBase rather than created directly in the service in order to distribute the load involved in creating them across several workers.

The service also provides a /feed/announcements endpoint that is used to provide content of special announcements for things like campaigns and fundraising. The content of these announcements is currently defined entirely within the service code.

The service also provides a /page/random/title endpoint. RESTBase exposes this as /page/random/{format}. {format} can be something like title, summary, html. So a client can get either just the title or the associated page content.

Metrics

The service reports response times via the metrics API provided by service-runner (as is the standard behavior of services based on the Node.js service template).

Service level indicators/objectives (SLIs/SLOs)[1]

SLI: Traffic
Endpoint SLO: Requests per second
/page/random 25 ≤ RPS ≤ 100
All others 1 ≤ RPS ≤ 10
SLI: Latency
Endpoint SLO: Max latency (p50)
/feed/onthisday/events 500ms
/media/image/featured 250ms
/page/most-read 200ms
All others 100ms
SLI: Server errors (5xx)
Endpoint SLO: Max 5xx error rate
All endpoints 1/1000

See also