# Alternative Sync API for Matrix
###### tags: `Lale` `Matrix` `Synapse`
## Problem
**Users with many rooms unable to login & sync!**
## Solution
### Based on Meeting with JJ, Chris, Jeff & Jan.
1. We `manually read` the sync data directly from the `DB`.
2. We read little by little (**limited rooms and limited events**).
3. We create API for this altenative sync API.
### Current Sync Developement
#### 1. Alternative Sync v0.0.1
- The alternative Sync **fetch the recent rooms by quering from DB**.
- After get the recent rooms, **make of use of matrix API to get recent events for each room**.
- This alternative Sync has the **same json format with original sync API** provided by Matrix.
**Limitation**:
- Some attribute **:still missing**:, because **we don't know how/where matrix store the data**:. (which particular data in which table)
- The performance is **slower** than original sync. Because we call matrix API a few time(ideally direct query to the DB).
#### 2. Long term Solution
- We develop the `Alternative sync`, but everything must **direct query to the DB**.
**Problem**:
- **We don't know how/where matrix store the data. We need to study the DB**.
- We need to **accept that we cannot get all the attribute** (same as original sync). Because when we try to fetch the same data as original sync, most probably our API will be **collapse** as well.
- We can overcome this later by **database replication** (separate write & read API )
**Time estimation**:
- Depend on the **attribute** (data) that we want to provide & how many **resources** (people) we spend to develop this.
- If we want to get **all the attributes** (same as original sync) and only **1 person** doing this, I am afraid this Sync won't be ready in 1 year.
#### 3. Proposed solution
- We go with the **2.(Long term solution)**.
- We develop it slowly.
- We do regular test (every week).
- The tester give report about the API and what **they expect from the API**. (for example, the API need to responds within 5s, the attribute `xxx` must be exist, etc.. )
- The developers know **what attributes that have higher priority**, and provided in the API.