Closed hopewise closed 4 years ago
I don't understand when requesting the app
part
What client did you use and what types of resource are requested?
You might want to try requesting using different clients (e.g. curl
, Postman)
And also try requesting different types of resources (HTML, CSS, JS, image)
I think we need those results to understand & analyze your issue
when requesting the app
I mean when opening the homepage in browser, the execjs get started and causes high CPU usage for a long time.
If I use curl, nodejs command will start:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2313 app 20 0 950292 51048 19448 R 47.4 2.5 0:00.70 nodejs
ps aux
app 2694 34.3 4.5 978576 92884 ? Rl 09:45 0:01 nodejs /tmp/execjs20200916-368-uzpmawjs
For curl command, first time, I get 504 gateway time-out
, then, second curl, I get:
HTTP/2 200
date: Wed, 16 Sep 2020 10:04:25 GMT
content-type: text/html; charset=utf-8
status: 200 OK
cache-control: max-age=0, private, must-revalidate
vary: Accept-Encoding
referrer-policy: strict-origin-when-cross-origin
x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
x-request-id: 36365117-7db6-4f82-a79f-d575fd6ce0bd
x-download-options: noopen
etag: W/"f4bb89ba5383f9e1d90e43aef5bc8a67"
x-frame-options: SAMEORIGIN
x-runtime: 0.019307
x-content-type-options: nosniff
set-cookie: XSRF-TOKEN=tNkG8EGyxBvADeySy5WgOTljAx4pbhZf0uH1pRPIMDczf5gPl5NBQNsHL6kti6aEs4MIRqk3fRARqqkVWHAQ5w%3D%3D; path=/
set-cookie: _dca_session=bVJMUmVIcjZzK0FmM1pFNXFqbXhldnNhVXhCYkREWnFKRkFWQno5TFNqMHRiU2VPcHRMa2VFcTZPbHJ0T1dQZUJGM2VMSnk4bU83bzJRT2VaZDZtYktMTTRPRW40Q2c1eGUvWklEZ3k2M1gwZk9OK3dkSXBET3g0bWlqcmdYQ050T1ZWNWVGNVVTYmliUVJYbVdzS2x4ajI3S3dOVU94VSt3VllSVzduMCthL1UxYVNIaTN3L2EwVEdDVFk4L1lMLS1nejU4SzJab0cvcFE1OTRPYlIrMmZnPT0%3D--3d67f57099f5c064f29adbda9a1af1ddf203602d; path=/; expires=Wed, 16 Sep 2020 12:04:25 GMT; HttpOnly
x-powered-by: Phusion Passenger 6.0.6
server: nginx/1.14.0 + Phusion Passenger 6.0.6
Do you use asset pipeline/webpacker/other methods to manage JS assets? But anyway it seems the app might be compiling the JS when HTML is requested You should try to see what assets (get the URLs, try JS assets first) are requested and try to request those URLs to see what happen Could be
I use webpacker, it seems I need to disable server side rendering? But it's not clear how to do it.
Thanks for your suggestions, I will try it.
I use webpacker too but I don't use asset sync anymore CDN is used for load assets from the app directly However if webpacker is compiling assets on prod that's probably something to do with config/setup instead of asset sync
Thanks, I am following up at webpacker.
I am using AWS ECS to deploy my app, the image I am using has no nodejs, therefore, I am pre compiling at the host container, and S3 sync works fine.
However, when requesting the app, execjs starts and nodejs processes start working for a long time, I am not sure if it actually rebuild the assets at production server??
How can I prevent this? Can you please check here: https://stackoverflow.com/questions/63895516/why-nodejs-process-starts-when-requesting-rails-app