Documentation
¶
Overview ¶
Package saaslab is SaaSLab, a multi-tenant B2B app: sign-in, records that users create and edit, heavy reports, a REST API and a GraphQL API (with automatic persisted queries) for dashboards. It is the reference app for the saas pack.
Its data lives in memory behind a simulated database: each store query costs a fixed round trip (300µs by default), so query counts show up as latency the way they do against a real database.
Planted bottlenecks (see README.md), each switched off by a fix flag:
- reports: every report scans the tenant's records and all tenants share two report workers, so one big tenant running reports makes everyone else's wait (fix "reports" gives each tenant its own worker, so a noisy tenant only queues behind itself).
- n1: GraphQL loads each record's owner with its own query, so a page of 20 records costs 21 round trips (fix "n1" loads owners in one batch).
- count: record lists count every matching record of the tenant on each page to report a total, so lists slow down with tenant size (fix "count" keeps the counts up to date).
Index ¶
Constants ¶
View Source
const Password = "saaslab-pass"
Password is every seeded user's password.
Variables ¶
View Source
var Tenants = []string{"megacorp", "acme", "globex", "initech", "umbrella", "hooli", "stark", "wayne", "wonka",
"tyrell", "cyberdyne", "soylent", "aperture", "monarch", "vandelay", "dunder", "pied-piper", "gringotts", "oscorp", "krusty"}
Tenants: megacorp is the big, noisy one; the rest are small.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.