Skip to content

Commit 0baf0fa

Browse files
authored
feat: add performance impact (#106)
1 parent dc2af69 commit 0baf0fa

4 files changed

Lines changed: 488 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: "Android SDK Performance Impact"
3+
description: "This document describes the performance impact of the Flashcat Android RUM SDK on your application."
4+
date: "2024-05-09T10:00:00+08:00"
5+
url: "https://docs.flashcat.cloud/en/flashduty/rum/android-sdk-performance-impact"
6+
---
7+
8+
## Overview
9+
10+
When integrating any SDK into an Android application, understanding its performance impact is crucial for maintaining a good user experience. The Flashcat RUM SDK is designed with performance in mind and provides transparent measurement data to help you make informed integration decisions.
11+
12+
## Performance Benchmark
13+
14+
To evaluate the actual performance impact of the SDK on your application, we conducted performance benchmarks under typical usage scenarios. The following SDK modules were enabled during testing:
15+
16+
- `fc-sdk-android-rum`: RUM core functionality
17+
- `fc-sdk-android-trace`: Distributed tracing
18+
- `fc-sdk-android-okhttp`: Network request tracking
19+
20+
The SDK was initialized with default configuration and simulated common user operations (such as page views, scrolling lists, network requests, etc.).
21+
22+
### Test Results
23+
24+
| Metric | With SDK | Without SDK | Impact |
25+
| --- | --- | --- | --- |
26+
| Peak CPU Usage | ~27% | ~25% | +2% |
27+
| Peak Memory Usage | ~435 MB | ~437 MB | Negligible |
28+
| App Launch Time | ~245 ms | ~230 ms | +15 ms |
29+
| APK Size | +500 KB | - | ~0.5 MB |
30+
| Network Usage | ~70 KB sent / ~20 KB received | - | Varies with event volume |
31+
32+
**Notes**:
33+
34+
- The above data are reference values under typical scenarios; actual impact may vary depending on application complexity, device performance, and SDK configuration
35+
- Memory usage increase is minimal and may not be noticeable in some scenarios
36+
- Network traffic depends on the number of collected events and sampling rate configuration
37+
38+
### Performance Impact Details
39+
40+
#### CPU Usage
41+
42+
The SDK's CPU impact primarily comes from:
43+
- Event collection and processing
44+
- Data batching and compression
45+
- Network request reporting
46+
47+
The SDK uses asynchronous processing and batch reporting mechanisms to avoid blocking the main thread, ensuring it does not affect the application's UI responsiveness.
48+
49+
#### Memory Usage
50+
51+
The SDK uses a fixed-size memory buffer to store pending event data, which does not grow indefinitely over time. Stale data is automatically cleaned up to ensure it does not consume excessive memory.
52+
53+
#### Launch Time
54+
55+
The SDK initialization process is optimized, with launch time impact controlled to milliseconds. It is recommended to initialize the SDK as early as possible in `Application.onCreate()` to capture the complete application startup process.
56+
57+
#### Package Size
58+
59+
The SDK uses a modular design, allowing you to include only the necessary functional modules to minimize the impact on APK size.
60+
61+
#### Network Usage
62+
63+
The SDK employs the following strategies to optimize network usage:
64+
- **Batch reporting**: Events are cached locally first and sent in batches to reduce the number of network requests
65+
- **Data compression**: Reported data is compressed to reduce transmission traffic
66+
- **Intelligent scheduling**: Upload timing is intelligently scheduled based on network status and battery level
67+
68+
## Continuous Performance Monitoring
69+
70+
Performance regression testing is conducted before each SDK release to ensure new versions do not introduce performance issues.
71+
72+
### Performance Optimization Recommendations
73+
74+
If you have specific performance requirements, consider the following optimization measures:
75+
76+
1. **Adjust sampling rate**: Reduce the number of collected events by configuring the sampling rate
77+
78+
```kotlin
79+
val rumConfig = RumConfiguration.Builder(applicationId)
80+
.setSessionSampleRate(80f) // Sample 80% of sessions
81+
.build()
82+
```
83+
84+
2. **Enable features on demand**: Only enable necessary tracking features
85+
86+
```kotlin
87+
val rumConfig = RumConfiguration.Builder(applicationId)
88+
.trackUserInteractions(false) // Disable user interaction tracking
89+
.trackLongTasks(false) // Disable long task tracking
90+
.build()
91+
```
92+
93+
3. **Configure upload strategy**: Adjust batch upload size and frequency
94+
95+
## Offline Data Storage
96+
97+
When the device is offline, the SDK stores data locally with strict storage space limits:
98+
99+
- Uses fixed-size disk cache
100+
- Expired data is automatically cleaned up
101+
- Cached data will not affect device storage space
102+
103+
## Related Documentation
104+
105+
- [Android SDK Integration Guide](https://docs.flashcat.cloud/en/flashduty/rum/android-sdk-integration): Learn how to integrate the SDK
106+
- [Android SDK Advanced Configuration](https://docs.flashcat.cloud/en/flashduty/rum/android-advanced-configuration): Learn about SDK advanced configuration options
107+
- [Android SDK Data Collection](https://docs.flashcat.cloud/en/flashduty/rum/android-data-collected): Learn what data the SDK collects
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
title: "iOS SDK Performance Impact"
3+
description: "This document describes the performance impact of the Flashcat iOS RUM SDK on your application."
4+
date: "2024-05-09T10:00:00+08:00"
5+
url: "https://docs.flashcat.cloud/en/flashduty/rum/ios-sdk-performance-impact"
6+
---
7+
8+
## Overview
9+
10+
When integrating any SDK into an iOS application, understanding its performance impact is crucial for maintaining a good user experience. The Flashcat RUM SDK is designed with the goal of minimizing performance overhead and provides transparent measurement data to help you evaluate whether the SDK meets your application's performance budget.
11+
12+
## Performance Benchmark
13+
14+
To evaluate the actual performance impact of the SDK on your application, we conducted performance benchmarks under typical usage scenarios. The following SDK features were enabled during testing:
15+
16+
- Basic RUM monitoring: View, action, and resource tracking
17+
- Distributed tracing
18+
19+
The SDK was initialized with default configuration and simulated common user operations (such as page views, scrolling lists, network requests, etc.).
20+
21+
### Test Results
22+
23+
| Metric | With SDK | Without SDK | Impact |
24+
| --- | --- | --- | --- |
25+
| Peak CPU Usage | ~44% | ~40% | +4% |
26+
| Peak Memory Usage | ~72 MB | ~68 MB | +4 MB |
27+
| App Launch Time | ~0.9 ms | ~0.65 ms | +0.25 ms |
28+
| Package Size | +1.4 MB | - | ~1.4 MB |
29+
| Network Usage | ~22 KB sent / ~2 KB received | - | Varies with event volume |
30+
31+
**Notes**:
32+
33+
- The above data are reference values under typical scenarios; actual impact may vary depending on application complexity, device performance, and SDK configuration
34+
- Launch time increase is minimal and barely perceptible to users
35+
- Network traffic depends on the number of collected events and sampling rate configuration
36+
37+
### Performance Impact Details
38+
39+
#### CPU Usage
40+
41+
The SDK's CPU impact primarily comes from:
42+
- Event collection and processing
43+
- Data batching and compression
44+
- Network request reporting
45+
46+
The SDK uses asynchronous processing mechanisms, with all data processing performed in background queues without blocking the main thread, ensuring it does not affect the application's UI responsiveness.
47+
48+
#### Memory Usage
49+
50+
The SDK uses a fixed-size memory buffer to store pending event data, which does not grow indefinitely over time. Stale data is automatically cleaned up to ensure it does not consume excessive memory.
51+
52+
#### Launch Time
53+
54+
The SDK initialization process is optimized, with impact on application launch time controlled to sub-millisecond level. It is recommended to initialize the SDK as early as possible in `AppDelegate`'s `didFinishLaunchingWithOptions` to capture the complete application startup process.
55+
56+
#### Package Size
57+
58+
The SDK uses a modular design, allowing you to include only the necessary functional modules:
59+
60+
- `FlashcatCore`: Core functionality (required)
61+
- `FlashcatRUM`: RUM monitoring
62+
- `FlashcatTrace`: Distributed tracing
63+
- `FlashcatWebView`: WebView tracking
64+
65+
Including only the necessary modules can minimize the impact on package size.
66+
67+
#### Network Usage
68+
69+
The SDK employs the following strategies to optimize network usage:
70+
- **Batch reporting**: Events are cached locally first and sent in batches to reduce the number of network requests
71+
- **Data compression**: Reported data is compressed to reduce transmission traffic
72+
- **Intelligent scheduling**: Upload timing is intelligently scheduled based on network status and battery level
73+
74+
## Continuous Performance Monitoring
75+
76+
Performance regression testing is conducted before each SDK release to ensure new versions do not introduce performance issues.
77+
78+
### Performance Optimization Recommendations
79+
80+
If you have specific performance requirements, consider the following optimization measures:
81+
82+
1. **Adjust sampling rate**: Reduce the number of collected events by configuring the sampling rate
83+
84+
```swift
85+
RUM.enable(
86+
with: RUM.Configuration(
87+
applicationID: "<RUM_APPLICATION_ID>",
88+
sessionSampleRate: 80 // Sample 80% of sessions
89+
)
90+
)
91+
```
92+
93+
2. **Enable features on demand**: Only enable necessary tracking features
94+
95+
```swift
96+
RUM.enable(
97+
with: RUM.Configuration(
98+
applicationID: "<RUM_APPLICATION_ID>",
99+
uiKitViewsPredicate: nil, // Disable automatic view tracking
100+
uiKitActionsPredicate: nil // Disable automatic action tracking
101+
)
102+
)
103+
```
104+
105+
3. **Disable background event tracking**: If you don't need to track background events
106+
107+
```swift
108+
RUM.enable(
109+
with: RUM.Configuration(
110+
applicationID: "<RUM_APPLICATION_ID>",
111+
trackBackgroundEvents: false
112+
)
113+
)
114+
```
115+
116+
## Offline Data Storage
117+
118+
When the device is offline, the SDK stores data locally with strict storage space limits:
119+
120+
- Uses fixed-size disk cache
121+
- Expired data is automatically cleaned up
122+
- Cached data will not affect device storage space
123+
124+
## Battery Consumption
125+
126+
The SDK is designed with battery consumption in mind:
127+
128+
- Automatically reduces upload frequency when battery level falls below a certain threshold
129+
- Leverages system background task mechanisms for data reporting
130+
- Avoids frequent device wake-ups
131+
132+
## Related Documentation
133+
134+
- [iOS SDK Integration Guide](https://docs.flashcat.cloud/en/flashduty/rum/ios-sdk-integration): Learn how to integrate the SDK
135+
- [iOS SDK Advanced Configuration](https://docs.flashcat.cloud/en/flashduty/rum/ios-advanced-configuration): Learn about SDK advanced configuration options
136+
- [iOS SDK Data Collection](https://docs.flashcat.cloud/en/flashduty/rum/ios-data-collected): Learn what data the SDK collects
137+
- [iOS SDK Compatibility](https://docs.flashcat.cloud/en/flashduty/rum/ios-compatibility): Learn about supported platform versions
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: "Android SDK 性能影响"
3+
description: "本文档介绍 Flashcat Android RUM SDK 对应用性能的影响。"
4+
date: "2024-05-09T10:00:00+08:00"
5+
url: "https://docs.flashcat.cloud/zh/flashduty/rum/android-sdk-performance-impact"
6+
---
7+
8+
## 概述
9+
10+
在将任何 SDK 集成到 Android 应用时,了解其性能影响对于维护良好的用户体验至关重要。Flashcat RUM SDK 在设计时充分考虑了性能因素,并提供透明的测量数据,帮助您做出明智的集成决策。
11+
12+
## 性能影响基准测试
13+
14+
为了评估 SDK 对应用性能的实际影响,我们在典型使用场景下进行了性能基准测试。测试中启用了以下 SDK 功能模块:
15+
16+
- `fc-sdk-android-rum`:RUM 核心功能
17+
- `fc-sdk-android-trace`:链路追踪
18+
- `fc-sdk-android-okhttp`:网络请求追踪
19+
20+
SDK 使用默认配置进行初始化,并模拟常见用户操作(如页面浏览、滚动列表、网络请求等)。
21+
22+
### 测试结果
23+
24+
| 指标 | 集成 SDK 后 | 未集成 SDK | 影响 |
25+
| --- | --- | --- | --- |
26+
| 峰值 CPU 使用率 | ~27% | ~25% | +2% |
27+
| 峰值内存使用 | ~435 MB | ~437 MB | 基本持平 |
28+
| 应用启动时间 | ~245 ms | ~230 ms | +15 ms |
29+
| APK 大小 | +500 KB | - | 约 0.5 MB |
30+
| 网络使用 | ~70 KB 发送 / ~20 KB 接收 | - | 根据事件量变化 |
31+
32+
**说明**
33+
34+
- 以上数据为典型场景下的参考值,实际影响会因应用复杂度、设备性能和 SDK 配置不同而有所差异
35+
- 内存使用增加极少,在某些场景下可能检测不到明显变化
36+
- 网络流量取决于收集的事件数量和采样率配置
37+
38+
### 性能影响详解
39+
40+
#### CPU 使用率
41+
42+
SDK 对 CPU 的影响主要来自:
43+
- 事件收集和处理
44+
- 数据批处理和压缩
45+
- 网络请求上报
46+
47+
SDK 采用异步处理和批量上报机制,避免阻塞主线程,确保不影响应用的 UI 响应性能。
48+
49+
#### 内存使用
50+
51+
SDK 使用固定大小的内存缓冲区存储待上报的事件数据,不会随时间无限增长。过旧的数据会被自动清理,确保不会占用过多内存。
52+
53+
#### 启动时间
54+
55+
SDK 初始化过程经过优化,启动时间影响控制在毫秒级。建议在 `Application.onCreate()` 中尽早初始化 SDK,以便捕获完整的应用启动过程。
56+
57+
#### 包大小
58+
59+
SDK 采用模块化设计,您可以根据需要只引入必要的功能模块,最小化对 APK 大小的影响。
60+
61+
#### 网络使用
62+
63+
SDK 采用以下策略优化网络使用:
64+
- **批量上报**:事件先缓存到本地,批量发送以减少网络请求次数
65+
- **数据压缩**:上报数据经过压缩处理,减少传输流量
66+
- **智能调度**:根据网络状态和电量情况智能调度上报时机
67+
68+
## 持续性能监控
69+
70+
每次 SDK 发布前都会进行性能回归测试,确保新版本不会引入性能问题。
71+
72+
### 性能优化建议
73+
74+
如果您对性能有特殊要求,可以考虑以下优化措施:
75+
76+
1. **调整采样率**:通过配置采样率减少收集的事件数量
77+
78+
```kotlin
79+
val rumConfig = RumConfiguration.Builder(applicationId)
80+
.setSessionSampleRate(80f) // 采样 80% 的会话
81+
.build()
82+
```
83+
84+
2. **按需启用功能**:只启用必要的追踪功能
85+
86+
```kotlin
87+
val rumConfig = RumConfiguration.Builder(applicationId)
88+
.trackUserInteractions(false) // 禁用用户交互追踪
89+
.trackLongTasks(false) // 禁用长任务追踪
90+
.build()
91+
```
92+
93+
3. **配置上报策略**:调整批量上报的大小和频率
94+
95+
## 离线数据存储
96+
97+
SDK 在设备离线时会将数据存储到本地,存储空间使用受到严格限制:
98+
99+
- 使用固定大小的磁盘缓存
100+
- 过期数据自动清理
101+
- 不会因缓存数据过多影响设备存储空间
102+
103+
## 更多阅读
104+
105+
- [Android SDK 接入指南](https://docs.flashcat.cloud/zh/flashduty/rum/android-sdk-integration):了解如何接入 SDK
106+
- [Android SDK 高级配置](https://docs.flashcat.cloud/zh/flashduty/rum/android-advanced-configuration):了解如何配置 SDK 的高级功能
107+
- [Android SDK 数据收集](https://docs.flashcat.cloud/zh/flashduty/rum/android-data-collected):了解 SDK 收集的数据类型

0 commit comments

Comments
 (0)