mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
latest updates
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -60,3 +60,5 @@ bw-output/
|
||||
# entity dump results
|
||||
# dump_entities.csv
|
||||
# dump_entities.xls*
|
||||
|
||||
benchmark/*.log
|
||||
|
||||
39
benchmark/http-client-test.js
Executable file
39
benchmark/http-client-test.js
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const axios = require('axios');
|
||||
|
||||
const url = 'http://10.10.10.135/api/system/commands';
|
||||
const queryParams = {
|
||||
entity: 'commands',
|
||||
id: 0
|
||||
};
|
||||
|
||||
const totalRequests = 1000000;
|
||||
const requestsPerCount = 100;
|
||||
|
||||
let requestCount = 0;
|
||||
|
||||
function fetchData() {
|
||||
axios
|
||||
.get(url, { params: queryParams })
|
||||
.then((response) => {
|
||||
requestCount++;
|
||||
|
||||
if (requestCount % requestsPerCount === 0) {
|
||||
console.log(`Requests completed: ${requestCount}`);
|
||||
}
|
||||
|
||||
if (requestCount < totalRequests) {
|
||||
fetchData();
|
||||
} else {
|
||||
console.log('All requests completed.');
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error making request:', error.message);
|
||||
});
|
||||
}
|
||||
|
||||
// Start making requests
|
||||
console.log(`Starting test`);
|
||||
fetchData();
|
||||
38
benchmark/loadtest-http.sh
Executable file
38
benchmark/loadtest-http.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install:
|
||||
# npm install -g autocannon
|
||||
# yarn global add autocannon
|
||||
#
|
||||
# or run https://github.com/nearform/autocannon-ui
|
||||
|
||||
TEST_IP="10.10.10.135"
|
||||
TEST_TIME=60
|
||||
LOG_FILE=http-loadtest.log
|
||||
TIMEOUT=10000
|
||||
PROTOCOL=http
|
||||
#PROTOCOL=https
|
||||
|
||||
if test -f "$LOG_FILE"; then
|
||||
rm $LOG_FILE
|
||||
fi
|
||||
|
||||
# for CONCURRENCY in 1 2 3 4 5 6 7 8 9 10 15 20
|
||||
for CONCURRENCY in 1
|
||||
#for CONCURRENCY in 20
|
||||
do
|
||||
printf "\n\nCLIENTS: *** $CONCURRENCY ***\n\n" >> $LOG_FILE
|
||||
echo "Testing $CONCURRENCY clients on $PROTOCOL://$TEST_IP/"
|
||||
autocannon -c $CONCURRENCY -w 1 -d $TEST_TIME --renderStatusCodes "$PROTOCOL://$TEST_IP/" >> $LOG_FILE 2>&1
|
||||
printf "\n\n----------------\n\n" >> $LOG_FILE
|
||||
sleep 1
|
||||
|
||||
echo "Testing $CONCURRENCY clients on $PROTOCOL://$TEST_IP/api/system/commands"
|
||||
autocannon -c $CONCURRENCY -w 1 -d $TEST_TIME --renderStatusCodes "$PROTOCOL://$TEST_IP/api/system/commands" >> $LOG_FILE 2>&1
|
||||
printf "\n\n----------------\n\n" >> $LOG_FILE
|
||||
sleep 1
|
||||
|
||||
echo "Testing $CONCURRENCY clients on $PROTOCOL://$TEST_IP/app/icon.png"
|
||||
autocannon -c $CONCURRENCY -w 1 -d $TEST_TIME --renderStatusCodes "$PROTOCOL://$TEST_IP/app/icon.png" >> $LOG_FILE 2>&1
|
||||
printf "\n\n----------------\n\n" >> $LOG_FILE
|
||||
sleep 1
|
||||
done
|
||||
8
benchmark/package.json
Normal file
8
benchmark/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"autocannon": "^7.14.0",
|
||||
"axios": "^1.6.2",
|
||||
"eventsource": "^2.0.2",
|
||||
"ws": "^8.14.2"
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alova/adapter-xhr": "^1.0.2",
|
||||
"@babel/core": "^7.23.6",
|
||||
"@babel/core": "^7.23.7",
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@mui/icons-material": "^5.15.2",
|
||||
@@ -29,7 +29,7 @@
|
||||
"@table-library/react-table-library": "4.1.7",
|
||||
"@types/imagemin": "^8.0.5",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.10.5",
|
||||
"@types/node": "^20.10.6",
|
||||
"@types/react": "^18.2.46",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
|
||||
@@ -86,26 +86,26 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/core@npm:^7.23.6":
|
||||
version: 7.23.6
|
||||
resolution: "@babel/core@npm:7.23.6"
|
||||
"@babel/core@npm:^7.23.7":
|
||||
version: 7.23.7
|
||||
resolution: "@babel/core@npm:7.23.7"
|
||||
dependencies:
|
||||
"@ampproject/remapping": "npm:^2.2.0"
|
||||
"@babel/code-frame": "npm:^7.23.5"
|
||||
"@babel/generator": "npm:^7.23.6"
|
||||
"@babel/helper-compilation-targets": "npm:^7.23.6"
|
||||
"@babel/helper-module-transforms": "npm:^7.23.3"
|
||||
"@babel/helpers": "npm:^7.23.6"
|
||||
"@babel/helpers": "npm:^7.23.7"
|
||||
"@babel/parser": "npm:^7.23.6"
|
||||
"@babel/template": "npm:^7.22.15"
|
||||
"@babel/traverse": "npm:^7.23.6"
|
||||
"@babel/traverse": "npm:^7.23.7"
|
||||
"@babel/types": "npm:^7.23.6"
|
||||
convert-source-map: "npm:^2.0.0"
|
||||
debug: "npm:^4.1.0"
|
||||
gensync: "npm:^1.0.0-beta.2"
|
||||
json5: "npm:^2.2.3"
|
||||
semver: "npm:^6.3.1"
|
||||
checksum: a72ba71d2f557d09ff58a5f0846344b9cea9dfcbd7418729a3a74d5b0f37a5ca024942fef4d19f248de751928a1be3d5cb0488746dd8896009dd55b974bb552e
|
||||
checksum: 956841695ea801c8b4196d01072e6c1062335960715a6fcfd4009831003b526b00627c78b373ed49b1658c3622c71142f7ff04235fe839cac4a1a25ed51b90aa
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -304,14 +304,14 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/helpers@npm:^7.23.6":
|
||||
version: 7.23.6
|
||||
resolution: "@babel/helpers@npm:7.23.6"
|
||||
"@babel/helpers@npm:^7.23.7":
|
||||
version: 7.23.7
|
||||
resolution: "@babel/helpers@npm:7.23.7"
|
||||
dependencies:
|
||||
"@babel/template": "npm:^7.22.15"
|
||||
"@babel/traverse": "npm:^7.23.6"
|
||||
"@babel/traverse": "npm:^7.23.7"
|
||||
"@babel/types": "npm:^7.23.6"
|
||||
checksum: 2a85fd2bcbc15a6c94dbe7b9e94d8920f9de76d164179d6895fee89c4339079d9e3e56f572bf19b5e7d1e6f1997d7fbaeaa686b47d35136852631dfd09e85c2f
|
||||
checksum: ec07061dc871d406ed82c8757c4d7a510aaf15145799fb0a2c3bd3c72ca101fe82a02dd5f83ca604fbbba5de5408dd731bb1452150562bed4f3b0a2846f81f61
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -439,9 +439,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@babel/traverse@npm:^7.23.6":
|
||||
version: 7.23.6
|
||||
resolution: "@babel/traverse@npm:7.23.6"
|
||||
"@babel/traverse@npm:^7.23.7":
|
||||
version: 7.23.7
|
||||
resolution: "@babel/traverse@npm:7.23.7"
|
||||
dependencies:
|
||||
"@babel/code-frame": "npm:^7.23.5"
|
||||
"@babel/generator": "npm:^7.23.6"
|
||||
@@ -453,7 +453,7 @@ __metadata:
|
||||
"@babel/types": "npm:^7.23.6"
|
||||
debug: "npm:^4.3.1"
|
||||
globals: "npm:^11.1.0"
|
||||
checksum: ee4434a3ce792ee8956b64d76843caa1dda4779bb621ed9f951dd3551965bf1f292f097011c9730ecbc0b57f02434b1fa5a771610a2ef570726b0df0fc3332d9
|
||||
checksum: 3215e59429963c8dac85c26933372cdd322952aa9930e4bc5ef2d0e4bd7a1510d1ecf8f8fd860ace5d4d9fe496d23805a1ea019a86410aee4111de5f63ee84f9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1566,12 +1566,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:^20.10.5":
|
||||
version: 20.10.5
|
||||
resolution: "@types/node@npm:20.10.5"
|
||||
"@types/node@npm:^20.10.6":
|
||||
version: 20.10.6
|
||||
resolution: "@types/node@npm:20.10.6"
|
||||
dependencies:
|
||||
undici-types: "npm:~5.26.4"
|
||||
checksum: 4a378428d2c9f692b19801a5a3d20dc4c0ad5d4a3d103350f8b401af439941a9aa5efeadc8eb9db13c66c620318bc7f336abfc8934f82fd32c4a689d85068c6f
|
||||
checksum: 08471220d3cbbb6669835c4b78541edf5eface8f2c2e36c550cfa4ff73da73071c90e200a06359fac25d6564127597c23e178128058fb676824ec23d5178a017
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1824,7 +1824,7 @@ __metadata:
|
||||
resolution: "EMS-ESP@workspace:."
|
||||
dependencies:
|
||||
"@alova/adapter-xhr": "npm:^1.0.2"
|
||||
"@babel/core": "npm:^7.23.6"
|
||||
"@babel/core": "npm:^7.23.7"
|
||||
"@emotion/react": "npm:^11.11.3"
|
||||
"@emotion/styled": "npm:^11.11.0"
|
||||
"@mui/icons-material": "npm:^5.15.2"
|
||||
@@ -1834,7 +1834,7 @@ __metadata:
|
||||
"@table-library/react-table-library": "npm:4.1.7"
|
||||
"@types/imagemin": "npm:^8.0.5"
|
||||
"@types/lodash-es": "npm:^4.17.12"
|
||||
"@types/node": "npm:^20.10.5"
|
||||
"@types/node": "npm:^20.10.6"
|
||||
"@types/react": "npm:^18.2.46"
|
||||
"@types/react-dom": "npm:^18.2.18"
|
||||
"@types/react-router-dom": "npm:^5.3.3"
|
||||
|
||||
@@ -169,8 +169,6 @@ build_flags =
|
||||
'-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"'
|
||||
|
||||
[env:https]
|
||||
; platform = espressif32@6.4.0
|
||||
;
|
||||
; use Tasmota's libary which removes some libs (like mbedtsl) and increases available heap
|
||||
; platform = https://github.com/tasmota/platform-espressif32.git ; latest development
|
||||
;
|
||||
@@ -189,23 +187,32 @@ framework = arduino
|
||||
board = esp32dev
|
||||
board_build.filesystem = littlefs
|
||||
board_build.f_cpu = 240000000L
|
||||
board_upload.flash_size = 16MB
|
||||
board_build.partitions = esp32_partition_16M.csv
|
||||
board_upload.flash_size = 4MB
|
||||
board_build.partitions = esp32_partition_4M.csv
|
||||
; board_upload.flash_size = 16MB
|
||||
; board_build.partitions = esp32_partition_16M.csv
|
||||
board_upload.use_1200bps_touch = false
|
||||
board_upload.wait_for_upload_port = false
|
||||
board_upload.wait_for_upload_port = true
|
||||
upload_port = /dev/ttyUSB0
|
||||
extra_scripts =
|
||||
pre:scripts/build_interface.py
|
||||
; pre:scripts/build_interface.py
|
||||
scripts/rename_fw.py
|
||||
build_unflags = ${common.unbuild_flags}
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
${common.core_build_flags}
|
||||
${factory_settings.build_flags}
|
||||
${common.my_build_flags}
|
||||
-D ONEWIRE_CRC16=0
|
||||
-D NO_GLOBAL_ARDUINOOTA
|
||||
-D ARDUINOJSON_ENABLE_STD_STRING=1
|
||||
-D ARDUINOJSON_USE_DOUBLE=0
|
||||
; -D ARDUINOTRACE_ENABLE=1
|
||||
-D ARDUINOTRACE_ENABLE=0
|
||||
-D TASMOTA_SDK
|
||||
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_WARN
|
||||
-D EMSESP_TEST
|
||||
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_WARN
|
||||
-D EMSESP_DEBUG
|
||||
; '-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"'
|
||||
; -D BOARD_HAS_PSRAM
|
||||
'-DEMSESP_DEFAULT_BOARD_PROFILE="Test"'
|
||||
|
||||
; to build and run: pio run -e standalone -t exec
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# -d '{ "value" : 22 }'
|
||||
|
||||
@host = http://ems-esp.local
|
||||
@host_dev = http://10.10.10.135
|
||||
@host_dev = http://10.10.10.190
|
||||
|
||||
@token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.2bHpWya2C7Q12WjNUBD6_7N3RCD7CMl-EGhyQVzFdDg
|
||||
|
||||
|
||||
@@ -1435,6 +1435,7 @@ void EMSESP::setupWeb() {
|
||||
// esp8266React services has 13
|
||||
// custom projects has around 23
|
||||
webServer.config.max_uri_handlers = 80;
|
||||
// webServer.config.uri_match_fn = NULL;
|
||||
|
||||
// TODO add support for https
|
||||
webServer.listen(80); // start the web server
|
||||
|
||||
@@ -151,7 +151,10 @@ esp_err_t WebAPIService::parse(PsychicRequest * request, JsonObject & input) {
|
||||
}
|
||||
|
||||
// normal return
|
||||
// as setContentType("application/json; charset=utf-8")
|
||||
// TODO check if needed to add utf-8 here
|
||||
response.setContentType("application/json; charset=utf-8"); // TODO doesn't seem to work
|
||||
// response.addHeader("Connection", "close");
|
||||
|
||||
return response.send();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user