Compatibility comparison of GitLab on YugabyteDB and TiDB For PostgreSQL
Tags: gitlab, yugabytedb, tidb, postgres
Published: 2022-06-23 02:15:26

## Testing Background

GitLab is a very popular source code management tool around the world. In earlier versions, users could choose to use MySQL or PostgreSQL databases, but since version 12.1.0, the official support for MySQL has been completely abandoned.

Many functions in the new version of GitLab are developed based on the characteristics of PostgreSQL, which is a benchmark product for many using PostgreSQL as the underlying data storage.

Let's imagine this user scenario. A large group is divided into many divisions. Each division or even a small team may maintain its own GitLab. How to manage these warehouses at the group level becomes a difficult problem. for example:

- Version issues (open source version and commercial version, high version and low version)
- Fine-grained permission control
- data backup
- Infrastructure utilization

If there is a unified GitLab environment with good scalability and high availability, it is undoubtedly the best solution. However, the traditional stand-alone PostgreSQL database cannot meet the above requirements. Can you consider running GitLab on a distributed database?

In previous articles, we have compared the compatibility performance of GitLab on CockroachDB and YugabyteDB. References:

- [Compatibility comparison of GitLab on CockroachDB and YugabyteDB (1) - System initialization](https://dev.to/dcopensource/compatibility-of-gitlab-on-cockroachdb-and-yugabytedb-i-system-initialization-28m3)
- [GitLab's Compatibility Comparison on CockroachDB and YugabyteDB (2) - Read and Write Scenario Test](https://dev.to/dcopensource/compatibility-of-gitlab-on-cockroachdb-and-yugabytedb-ii-read-and-write-scenario-testing-33cg)

The test results of the above two distributed databases compatible with the PG protocol are that YugabyteDB has better compatibility, while the domestic distributed database TiDB's community project [TiDB For PostgreSQL] (https://github.com/DigitalChinaOpenSource/TiDB-for-PostgreSQL) ) is also compatible with most GitLab functions, reference materials:

- [TiDB For PostgreSQL is compatible with GitLab](https://zhuanlan.zhihu.com/p/448122284)

In this article, we will select some core scenarios of GitLab on YugabyteDB and TiDB For PostgreSQL to compare the compatibility and performance, so as to provide more reference value for GitLab running on distributed databases.

## Test Environment

### 1. GitLab

| Configuration item | Description |
| -------- | ------------------ |
| Version | 12.1.0-ee |
| Deployment Environment | Ubuntu 18.04 x86 16c 32G hdd |

### 2. YugabyteDB

| Configuration item | Description |
| -------- | ------------------------------ |
| Version | 2.13.2.0 |
| Deployment Environment | 3 Node CentOS 7.9 x86 4c 8G ssd |
| Deployment Architecture | 3 replicas, 3 nodes each for Master and Tserver |

### 3. TiDB For PostgreSQL

| Configuration item | Description |
| -------- | -------------------------------------- |
| Version | TiDB-v5.3.0 , PostgreSQL 12 compatible |
| Deployment Environment | 3 Node CentOS 7.9 x86 4c 8G hdd |
| Deployment Architecture | 3 replicas, 1 PD, 1 TiDB, 3 TiKV |

### 4. Jmeter

| Configuration item | Description |
| -------- | ------------------ |
| Version | 5.4 |
| Deployment Environment | Windows 10 12c 16G |

## Test Scenarios

| Scene Type | Scene name                                                     |
| -------- | ------------------------------------------------------------ |
| read (5)   | - Project List <br />- Project View <br />- Branch List <br />- Issue List <br />- Merge Request List |
| write (3)   | - New Commit <br />- Create Branch <br />- Create Issue      |

For each read scenario, we will stress test 4 different concurrency levels, namely 10, 20, 50, and 100, and run continuously for 5 minutes.

For each write scenario, 1,000 sample data will be tested under the premise of the previous four concurrency levels.

## Test Results

### 1、Project List

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>1.901</td>
	    <td >10.7</td>
	    <td>0</td>
	    <td>1.685</td>
	    <td>11.8</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>4.283</td>
	    <td >9.9</td>
	    <td>0</td>
	    <td>4.05</td>
	    <td>11.6</td>
	    <td>0.14</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>8.254</td>
	    <td >9.6</td>
	    <td>0</td>
	    <td>14.955</td>
	    <td>11.1</td>
	    <td>0.44</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>12.617</td>
	    <td >9.6</td>
	    <td>0</td>
	    <td>21.186</td>
	    <td>10.6</td>
	    <td>0.46</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixwilg4l77dw6vszj4wd.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Result analysis:

- The response time of TiDB For PostgreSQL increases significantly with the increase of concurrency, but the throughput cannot be improved. 10 concurrency is the best performance in this test.
- YugabyteDB also shows the same situation, and the error rate gradually increases.
- In this scenario, the performance and stability of GitLab running on TiDB For PostgreSQL is slightly better.

### 2、Project View

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>4.164</td>
	    <td>5.9</td>
	    <td>0</td>
	    <td>3.014</td>
	    <td>6.1</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>8.745</td>
	    <td>5.4</td>
	    <td>0</td>
	    <td>5.272</td>
	    <td>5.8</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>13.718</td>
	    <td>5.4</td>
	    <td>0.42</td>
	    <td>11.557</td>
	    <td>6.3</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>21.998</td>
	    <td>5.4</td>
	    <td>1.45</td>
	    <td>17.912</td>
	    <td>6.5</td>
	    <td>0</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smlrl3biunb4xn8c6g2i.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Result analysis:

- TiDB For PostgreSQL still shows the best performance under 10 concurrency pressure.
- YugabyteDB also reflects the same situation, but the response time is slightly smaller, the throughput is larger, and the gap is relatively stable.
- GitLab runs better on YugabyteDB in this scenario.

### 3、Branch List

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>2.687</td>
	    <td>7.3</td>
	    <td>0</td>
	    <td>1.541</td>
	    <td>11.8</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>6.101</td>
	    <td>6.8</td>
	    <td>0</td>
	    <td>3.515</td>
	    <td>11.2</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>11.043</td>
	    <td>6.6</td>
	    <td>0</td>
	    <td>6.642</td>
	    <td>11.2</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>18.3</td>
	    <td>6.7</td>
	    <td>0</td>
	    <td>12.076</td>
	    <td>11</td>
	    <td>0</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ocxbd7sv6tdkicapxcag.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Result analysis:

- TiDB For PostgreSQL also has the best performance at 10 concurrency.
- The overall trend of YugabyteDB is consistent, but the response time and throughput are significantly better than TiDB4PG.
- GitLab runs better on YugabyteDB in this scenario.

### 4、Issue List

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>1.696</td>
	    <td>11.8</td>
	    <td>0</td>
	    <td>1.56</td>
	    <td>12.2</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>3.613</td>
	    <td>10.8</td>
	    <td>0</td>
	    <td>2.871</td>
	    <td>13.5</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>7.155</td>
	    <td>11.1</td>
	    <td>0</td>
	    <td>5.966</td>
	    <td>12.7</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>12.06</td>
	    <td>11</td>
	    <td>0</td>
	    <td>9.769</td>
	    <td>12.8</td>
	    <td>0</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5xmt50ayngopm58up86m.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Result analysis:

- Similar to the previous scenario, GitLab runs better on YugabyteDB in this scenario, but the difference is not significant.

### 5、Merge Request List

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>1.975</td>
	    <td>10.9</td>
	    <td>0</td>
	    <td>1.355</td>
	    <td>13.5</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>3.838</td>
	    <td>9.9</td>
	    <td>0</td>
	    <td>3.222</td>
	    <td>12.7</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>8.057</td>
	    <td>9.9</td>
	    <td>0</td>
	    <td>6.34</td>
	    <td>11.7</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>13.437</td>
	    <td>9.7</td>
	    <td>0</td>
	    <td>10.426</td>
	    <td>11.9</td>
	    <td>0</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lipg4stbo22etiagxcbk.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Result analysis:

- The trend is the same on both sides. YugabyteDB's test results are better than TiDB4PG, and the gap is not very large.

### 6、New Commit

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/min)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/min)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>2.357</td>
	    <td>52.2</td>
	    <td>0</td>
	    <td>2.304</td>
	    <td>52.7</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>2.323</td>
	    <td>52.3</td>
	    <td>0</td>
	    <td>2.271</td>
	    <td>53.8</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>2.391</td>
	    <td>51.3</td>
	    <td>0</td>
	    <td>2.366</td>
	    <td>53.2</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>2.361</td>
	    <td>51</td>
	    <td>0</td>
	    <td>2.338</td>
	    <td>52.1</td>
	    <td>0</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwtz503uhmj0p9xc1ot1.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Analysis results: 

- Concurrency has little effect on both sides, response time and throughput are stable, and there is almost no difference in performance between the two.

### 7、Create Branch

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>4.08</td>
	    <td>3.9</td>
	    <td>0</td>
	    <td>15.186</td>
	    <td>3.2</td>
	    <td>0</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>8.386</td>
	    <td>4.1</td>
	    <td>0</td>
	    <td>27.249</td>
	    <td>3.2</td>
	    <td>1.5</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>59.681</td>
	    <td>1.8</td>
	    <td>51.3</td>
	    <td>67.882</td>
	    <td>1.8</td>
	    <td>42.6</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>100.633</td>
	    <td>3.2</td>
	    <td>75.9</td>
	    <td>60.061</td>
	    <td>7.4</td>
	    <td>82.6</td>
	</tr>
</table>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sx3pqfsghgc92jc9q6j4.png)

<center>（99% response time trend comparison, higher means longer time）</center>


Result analysis:

- When the concurrency is relatively small, the performance of TiDB For PostgreSQL is significantly better than that of YugabyteDB, and the error rates on both sides increase rapidly after the concurrency is increased.

### 8、Create Issue

<table style="text-align:center">
	<tr>
	    <th rowspan="2">Threads</th>
	    <th colspan="3">TiDB For PostgreSQL</th>
	    <th colspan="3">YugabyteDB</th>  
	</tr>
	<tr>
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	    <th>99 Line(s)</th>
	    <th>Throughput(/sec)</th>
	    <th>Error(%)</th>  
	</tr >
	<tr >
	    <td>10</td>
	    <td>-</td>
	    <td >-</td>
	    <td>100</td>
	    <td>17.284</td>
	    <td>6.4</td>
	    <td>69.1</td>
	</tr>
	<tr >
	    <td>20</td>
	    <td>-</td>
	    <td>-</td>
	    <td>100</td>
	    <td>10.818</td>
	    <td>11</td>
	    <td>79.5</td>
	</tr>
	<tr >
	    <td>50</td>
	    <td>-</td>
	    <td>-</td>
	    <td>100</td>
	    <td>5.877</td>
	    <td>20</td>
	    <td>92.60</td>
	</tr>
	<tr >
	    <td>100</td>
	    <td>-</td>
	    <td>-</td>
	    <td>100</td>
	    <td>10.084</td>
	    <td>21.8</td>
	    <td>93.4</td>
	</tr>
</table>


Result analysis:

- TiDB For PostgreSQL cannot yet support the creation of Issues, and the error rate is 100%.
- YugabyteDB can create Issues, but in the case of concurrency, the error rate is also very high, and the response time is very long.


## Summarize

In this test result, in most scenarios, GitLab running on YugabyteDB has slightly better performance than TiDB For PostgreSQL, which can be used as a performance reference for these two databases to a certain extent. At the same time, TiDB For PostgreSQL has some differences in compatibility. Supported features.

However, there are some reasons that may also affect the test results, including differences in the underlying data on both sides, differences in warehouse size, etc., because the above test scenarios involve not only database reading and writing, but also a large part of file operations.

On the other hand, from the perspective of the underlying architecture of the two, YugabyteDB's computing and storage layers are both in the TServer node. Compared with the deployment structure of TiDB For PostgreSQL, it is equivalent to at least 2 fewer network requests, which is also a factor that affects the stress test results. one.

TiDB For PostgreSQL is still in the process of continuous improvement, and this test result can also provide guidance for product development.