Compare commits

..

No commits in common. "e12e59461bf3b340afdf3b21e55f3d6ddc0cafa6" and "0242534274731abc1cade3c44d835a6b1f95e0da" have entirely different histories.

4 changed files with 22 additions and 45 deletions

View File

@ -41,30 +41,26 @@ hey -c 100 -n 100000 http://localhost:8080/
### Key Metrics to Watch
| Metric | Description |
| -------------------- | ---------------------------- |
| Requests/sec | Throughput |
| Average latency | Mean response time |
| P99 latency | Tail latency |
| Status codes | Error rate (should be 0) |
| Metric | Description |
|--------|-------------|
| Requests/sec | Throughput |
| Average latency | Mean response time |
| P99 latency | Tail latency |
| Status codes | Error rate (should be 0) |
| Latency distribution | Consistency (tight = stable) |
### Flame Graph Hotspots
| Expected Hotspot | Code Location | Cause |
| --------------------------------- | ---------------- | -------------------------------------------- |
| SSR rendering | Dioxus framework | Virtual DOM diff + render per request |
| `deadpool` connection acquisition | `src/db/mod.rs` | Connection pool contention under concurrency |
| `moka` cache lookup | `src/cache.rs` | Cache hit/miss overhead |
| `tokio` scheduling | tokio runtime | Async task dispatch |
| `serde` serialization | Models | Post/User serialization |
| Expected Hotspot | Code Location | Cause |
|------------------|---------------|-------|
| SSR rendering | Dioxus framework | Virtual DOM diff + render per request |
| `deadpool` connection acquisition | `src/db/mod.rs` | Connection pool contention under concurrency |
| `moka` cache lookup | `src/cache.rs` | Cache hit/miss overhead |
| `tokio` scheduling | tokio runtime | Async task dispatch |
| `serde` serialization | Models | Post/User serialization |
### Tuning
- `DB_POOL_SIZE` — increase if `deadpool` / `Semaphore` shows high in flame graph
- `SSR_CACHE_SECS` — increase to cache SSR output longer
- `TOKIO_WORKER_THREADS` — explicitly set worker thread count
## CI
https://git.rua.plus/api/v1/repos/xfy/yggdrasil/actions/tasks

View File

@ -176,7 +176,8 @@ mod tests {
#[test]
fn render_comment_link_data_uri_removed() {
let result = render_comment_markdown("[click](data:text/html,<script>alert(1)</script>)");
let result =
render_comment_markdown("[click](data:text/html,<script>alert(1)</script>)");
assert!(result.contains("click"));
assert!(!result.contains("data:"));
}

View File

@ -382,12 +382,8 @@ mod tests {
fn render_markdown_code_block() {
let result = render_markdown_enhanced("```rust\nfn main() {}\n```");
assert!(result.html.contains(r#"<pre><code class="language-rust">"#));
assert!(result
.html
.contains(r#"<span class="entity name function rust">main</span>"#));
assert!(result
.html
.contains(r#"<span class="storage type function rust">fn</span>"#));
assert!(result.html.contains(r#"<span class="entity name function rust">main</span>"#));
assert!(result.html.contains(r#"<span class="storage type function rust">fn</span>"#));
}
#[test]
@ -403,12 +399,8 @@ mod tests {
let result = render_markdown_enhanced("```html\n<script>alert(1)</script>\n```");
assert!(result.html.contains("<pre><code class=\"language-html\">"));
assert!(!result.html.contains("<script>"));
assert!(result
.html
.contains(r#"<span class="variable function js">alert</span>"#));
assert!(result
.html
.contains(r#"<span class="constant numeric js">1</span>"#));
assert!(result.html.contains(r#"<span class="variable function js">alert</span>"#));
assert!(result.html.contains(r#"<span class="constant numeric js">1</span>"#));
}
#[test]

View File

@ -217,30 +217,18 @@ mod tests {
#[test]
fn clean_tags_trims_whitespace() {
let input = vec![" rust ".to_string(), "\t\nwasm\t".to_string()];
assert_eq!(
clean_tags(&input),
vec!["rust".to_string(), "wasm".to_string()]
);
assert_eq!(clean_tags(&input), vec!["rust".to_string(), "wasm".to_string()]);
}
#[test]
fn clean_tags_filters_empty_strings() {
let input = vec![
"".to_string(),
" ".to_string(),
"\t".to_string(),
"valid".to_string(),
];
let input = vec!["".to_string(), " ".to_string(), "\t".to_string(), "valid".to_string()];
assert_eq!(clean_tags(&input), vec!["valid".to_string()]);
}
#[test]
fn clean_tags_preserves_duplicates() {
let input = vec![
"rust".to_string(),
" rust ".to_string(),
"rust".to_string(),
];
let input = vec!["rust".to_string(), " rust ".to_string(), "rust".to_string()];
assert_eq!(
clean_tags(&input),
vec!["rust".to_string(), "rust".to_string(), "rust".to_string()]