Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
5818a122
Commit
5818a122
authored
Oct 25, 2017
by
Jeremy Morrell
Committed by
Jeremy Morrell
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaking
parent
306d2dee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
WEB_CONCURRENCY.sh
profile/WEB_CONCURRENCY.sh
+6
-7
No files found.
profile/WEB_CONCURRENCY.sh
View file @
5818a122
...
@@ -4,7 +4,7 @@ calculate_concurrency() {
...
@@ -4,7 +4,7 @@ calculate_concurrency() {
WEB_CONCURRENCY
=
${
WEB_CONCURRENCY
-
$((
MEMORY_AVAILABLE/WEB_MEMORY
))}
WEB_CONCURRENCY
=
${
WEB_CONCURRENCY
-
$((
MEMORY_AVAILABLE/WEB_MEMORY
))}
if
((
WEB_CONCURRENCY < 1
))
;
then
if
((
WEB_CONCURRENCY < 1
))
;
then
WEB_CONCURRENCY
=
1
WEB_CONCURRENCY
=
1
elif
((
WEB_CONCURRENCY
>
1
00
))
;
then
elif
((
WEB_CONCURRENCY
>
2
00
))
;
then
# Ex: This will happen on Dokku on DO
# Ex: This will happen on Dokku on DO
WEB_CONCURRENCY
=
1
WEB_CONCURRENCY
=
1
fi
fi
...
@@ -27,25 +27,24 @@ detect_memory() {
...
@@ -27,25 +27,24 @@ detect_memory() {
}
}
warn_bad_web_concurrency
()
{
warn_bad_web_concurrency
()
{
local
memory
=
${
MEMORY_AVAILABLE
-
$(
detect_memory 512
)}
local
concurrency
=
$((
MEMORY_AVAILABLE/WEB_MEMORY
))
if
[
"
$concurrency
"
-gt
"200"
]
;
then
# No webserver will have 10000GB of RAM
if
[
$memory
-gt
"10000000"
]
;
then
echo
"Could not determine a reasonable value for WEB_CONCCURENCY.
echo
"Could not determine a reasonable value for WEB_CONCCURENCY.
This is likely due to running the Heroku NodeJS buildpack on a non-Heroku
This is likely due to running the Heroku NodeJS buildpack on a non-Heroku
platform.
platform.
WEB_CONCURRENCY has been set to 1. Please review whether this value is
WEB_CONCURRENCY has been set to 1. Please review whether this value is
appropriate for your application."
appropriate for your application."
echo
""
fi
fi
}
}
warn_bad_web_concurrency
export
MEMORY_AVAILABLE
=
${
MEMORY_AVAILABLE
-
$(
detect_memory 512
)}
export
MEMORY_AVAILABLE
=
${
MEMORY_AVAILABLE
-
$(
detect_memory 512
)}
export
WEB_MEMORY
=
${
WEB_MEMORY
-512
}
export
WEB_MEMORY
=
${
WEB_MEMORY
-512
}
export
WEB_CONCURRENCY
=
$(
calculate_concurrency
)
export
WEB_CONCURRENCY
=
$(
calculate_concurrency
)
warn_bad_web_concurrency
if
[[
"
${
LOG_CONCURRENCY
+isset
}
"
&&
"
$LOG_CONCURRENCY
"
==
"true"
]]
;
then
if
[[
"
${
LOG_CONCURRENCY
+isset
}
"
&&
"
$LOG_CONCURRENCY
"
==
"true"
]]
;
then
log_concurrency
log_concurrency
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment