Skip to content

Commit a4a0809

Browse files
authored
Add Performance Problems to troubleshooting guide (#573)
1 parent d4bd2ef commit a4a0809

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/src/guide/troubleshooting.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,32 @@ This section lists a few common gotchas, and bugs introduced in the past.
2727

2828
Please skim through __before__ opening an [issue][GitHub Issues].
2929

30+
## Performance Problems
31+
32+
### Slow development environment
33+
34+
Because Vite does not bundle your code during development, larger applications can end up depending on hundreds — even thousands — of individual assets.
35+
36+
By default, Vite Ruby proxies these assets through your Rails server at `/vite-dev/*`. Since Rails servers are not typically configured to handle thousands of concurrent IO-bound requests, this can lead to significant amounts of request queueing.
37+
38+
There are three different ways to solve this:
39+
40+
1. Configure the [`skipProxy`](/config/index.html#skipproxy-experimental) setting to `true`. Requests will be sent to the Vite development server directly, without going through your Rails server.
41+
2. Increase the number of Puma threads in development. Puma is typically configured with `3` threads, which is great for production when your assets are bundled or even handled by a separate proxy or CDN, but this should be increased to `100` or more when using Vite Ruby’s proxy in development.
42+
3. If you are running your app through a separate proxy such as [Caddy](https://caddyserver.com) in development, you can configure it to proxy requests that match `/vite-dev/*` directly to the Vite development server while leaving the rest of your app to be served by your Rails server.
43+
44+
Here’s an example `Caddyfile` configuration.
45+
46+
```
47+
myapp.localhost {
48+
handle /vite-dev/* {
49+
reverse_proxy localhost:3036
50+
}
51+
reverse_proxy localhost:5400
52+
tls internal
53+
}
54+
```
55+
3056
## Installation Problems
3157

3258
### Missing executable error

0 commit comments

Comments
 (0)