title,body,link,tags,view_count,is_answered,score,answer_count
Load generator in stress testing,"<p>Is it necessary to have load generator in stress testing. I am stress testing a e-commerce website and in my case I think I don't need run more that 300 virtual users. This amount of users I can run from JMeter non-gui mode. Is this will efficient? Thanks.</p>
",https://stackoverflow.com/questions/68769061/load-generator-in-stress-testing,"['testing', 'jmeter', 'blazemeter']",124,True,0,1
Bottleneck in stress testing Node web server,"<p>This question is really bugging me for past few days and I have no logical explanation of this whatsoever. It came up after me testing out how epoll and libuv generally works in Node and by experimenting scalability of an express / http server. My tests were diversified into 2 segments.</p>
<ol>
<li>Creating http server with single Node process.</li>
<li>Creating http server with multiple Node processes trough clustering.</li>
</ol>
<p>I also had a 2nd stress testing server that used JMeter to stress test on how much concurrent connections can it handle per second.</p>
<p>single Node process code:</p>
<pre><code>const express = require('express')
var bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));


setInterval(function () {

    console.log(&quot;Per sec: &quot;+ currentSec);
    currentSec = 0

    console.log(&quot;------------------------&quot;)

}, 1000);


app.get('/', (req, res) =&gt; {
 currentSec++
 res.send(&quot;OK&quot;)
})
app.listen(3000, &quot;XXX.XXX.XXX.XXX&quot;);
</code></pre>
<p>multiple Node processes</p>
<pre><code>const express = require('express')
var bodyParser = require('body-parser')

var cluster = require('cluster');
var numCPUs = require('os').cpus().length;


if (cluster.isMaster) {


    setInterval(function () { //syncronizer , ram - file
    // i had some logic here for counting global per second
    }, 1000);


    for (var i = 0; i &lt; numCPUs; i++) {
        const worker = cluster.fork();
    }

} else {
    var app = express();

    app.get('/', async function (req, res) {
        res.send(&quot;ok&quot;)
        return
    });

    app.listen(3000, 'XXX.34.XXX.121');
}
</code></pre>
<p>Both codes were counting how much requests were incoming per second, but I've also had option to see it inside JMeter so it wasn't really a problem.
Before anything, I want to clarify that I made a very simple GET route on purpose as I wanted to test the load on simple web server that does not use help of any libuv threads which could stress out cores on machine even more, but rather using only main event loop thread to process socket writing which was the actually purpose of testing (understanding if bottleneck is in Kernel or rather in main event loop processing the application data) and managing to balance out 1 core per process as much as possible.</p>
<p>I've read quiet interesting documentations on how Node processes network I/O communication and the way it uses epoll to gather file descriptors which it uses after appending aplpication data to write towards socket with help of system calls. I've understood the complexity part of it and the fact that all socket writing and reading is being done by Kernel itself and not Node, leaving only Node to handle with application data layer and <strong>it doing non blocking system call later on when finished with simple processing</strong> after which Kernel uses to trigger driver calls towards network adapter. Upon receiving the data from client, Kernel gets triggered by hardware interrupts and then notifies epoll about changes in file descriptors, making the whole writing / read process pretty straightforward, abstractly at least.</p>
<p>Results that I've got were kind of shocking taking the fact that my guess on start was that Node would have the same result in both scenarios(either using multi processes or single process). My assumption was that the complexity of reading file descriptors, appending data to socket and getting information from Kernel upon some event such new socket opened would result same if there were multi cores involved into processing compared to just 1, making clustering pretty redundant in terms of processing <strong>simple http</strong> requests like that. My theory was that the overhead in ICP communication via pipe would be slowing it even more, making one thread, 1 process Node faster or same compared to multi core architecture via clustering. In my head, this was something like diversifying <code>for loop</code> that does 100k cycles of some math calculations towards 8 cores vs just using 1 core to do that in first place, assuming this 100k cycles operation was being triggered by some http event and then diversified around other cores from master process. In practice, this would work if there was no overhead in communication from a single process(in our case master server) that diversifies work towards 8 other cores, making it much faster to process with 1 core based on some event trigger like GET request in our case due to overheads in communication if we used multi cores for this. Operations that main event loop is doing when handling TCP socket and doing a system call seemed so trivial to me CPU complexity wise, that I thought achieving parallelism in terms of multicore usage was pretty redundant due to the fact that bottleneck in the end was Kernel which was doing all the final touch and sending socket out to the network driver and that Node's process was just doing small non blocking portion.</p>
<p>I imagined the process as follows (in this example lets look at this 1st scenario using just 1 Node process).</p>
<p><strong>Scenario number 1 (single process):</strong></p>
<p>JMeter triggers some number of requests, lets say N. Network adapter at server side receives it and does hardware interrupt towards Kernel where Kernel then notifies epoll that there are some new events which it has to handle, and then main event loop after some amount of time (lets say K) starts going trough all the events that came over and starts writting application data towards the socket.</p>
<p><a href=""https://i.stack.imgur.com/cGUB7.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/cGUB7.png"" alt=""Wait for epoll explained"" /></a></p>
<p>Upon gathering file descriptors and writting of application data (in this case &quot;ok&quot; content), it does system call to Kernel that socket is ready and that it's ready for send and then Kernel sends it over to network driver and then the packet is being sent over towards the client that did request in first place.</p>
<p><strong>What happens in scenario nr. 2 when it comes to multi processing and clustering?</strong></p>
<p>Even though every worker process is 'listening' on same port, in reality it's not like this. Master process and master's main event loop is the one that is listening on this port and all it does it registers workers in separate tcp communication channel, or pipe, depending on implementation to later on offload the socket application data appending, making the bottleneck just this main master process which uses 1 event loop same as in first scenario (<em>WHICH CREATED BIGGEST CONFUSION HERE!</em>).
Upon client sending over HTTP request, what happens <em><strong>I think</strong></em> for every request is pretty similar to first scenario. Kernel receives hardware interrupt, then it notifies epoll from first master process that new event occurred and then main event loop takes file descriptor it has to read from and what happens then is that main master process which forked all other clusters is offloading that file descriptor / work towards other processes in terms notifying it about some work they have to do (in this case, it <em>possibly</em> gives them file descriptor they have to manipulate with). By this, we achieve parallelism by using multi cores and actually trying to increase speed of processing something <strong>very simple</strong> in terms of CPU consumption which is <strong>non blocking system call and application data append</strong></p>
<p><strong>RESULTS</strong></p>
<p>Before mentioning anything, I was testing this on 8core CPU server with 16GB ram and 1/1Gbps bandwith.
JMeter was using another exactly same spec machine.
Every request had no <code>keep-alive</code> header, meaning that sockets were reopening every time.
RTT was aprox 8 ms between client and server.</p>
<p><em>1st scenario using server running on 1 Node process(with 1 main event loop).</em></p>
<p>Server was receiving and processing approximately 2,500 - 3,500 concurrent connections per second.</p>
<p><em>2nd scenario using server running on 8 Node processes(with 8 main event loops).</em></p>
<p>Server was receiving and processing approximately 11,00 - 13,000 concurrent connections per second.</p>
<p><em><strong>CONFUSIN SUMMARIZED</strong></em></p>
<p>Based on all the things I researched about and taking the fact that all  these processes do is simple non blocking system requests, my question is, how is it possible that 8 processes managed to achieve better result taking in consideration that bottlenecks were the same in both tests? Bottleneck on global level is Kernel - OS and in our application (both scenarios) its a Node server listening on some particular port using 1 main event loop and epoll to poll the ready sockets. In first scenario we had 1 process listening on port 3000 (1 main event loop) and in second scenario we had also 1 process(main master) with its main event loop listening on port 3000 and offloading every request to workers to fill that file descriptor - &gt;&gt; socket with application data and then finish off with system call. It just doesn't make sense to me that 8 processes performed better then this 1 process in first scenario taking the fact that operations they had to do when receiving event from epoll are very trivial which in the end are just non blocking system calls.</p>
<p><strong>My unconfirmed explanation why it happened?</strong></p>
<p>Lets assume that network adapter due to high bandwidth and low message size can accept much more then 10,000 connections per second(in our case). Now it gets me to a point where only explanation for this is that all articles I've read about clustering and the way of how complex operations for I/O networking that main event loop is doing are very untrue. Assuming 1 node process achieved 3,000 concurrent requests and 8 processes did 12,000 explains that it indeed managed to process more connections by providing more core power to process <code>something</code> under the hood after epoll received file descriptor. Every article I've read so far explained that this process is not CPU heavy at all as it only does <strong>simple non blocking system call after it receives descriptors and fills application data</strong>. My only explanation is that before the system call, filling application data is <strong>INDEED CPU heavy in some way</strong> and I need someone to actually point me in the right direction. Also, there might be a possibility that articles were wrong when they were referring that master process is sending out file descriptors / socket locations to other worker processes, but rather I think there might be a chance that on start when Node is started it just registers all 8 different epolls to Kernel so when new request comes in, it does some round robin principle and it is informing 8 different epoll listeners about new request and not going trough master process directly(just my guess). By this, we achieve multi core parallelism for handling expensive operation, which is possibly data application appending towards socket. If this is true and that there are actually 8 different epoll listeners, then this means that processing I/O network socket and writing application data is indeed heavy and that bottleneck is rather in Node application and how it processes sockets and appends application data before doing system calls.</p>
<p>Does someone have any logical explanation for this?</p>
",https://stackoverflow.com/questions/65704218/bottleneck-in-stress-testing-node-web-server,"['node.js', 'multithreading', 'express', 'node-modules', 'libuv']",220,False,0,0
Stress testing of SQL Server Analysis Services tabular model,"<p>I have a tabular model in SSAS. Before deploying to production I would like to test the performance of the model in the way: How many users can use the model without any performance issues. When all the resources of the server will be exhausted and so on. I know that I can measure actual traffic with Profiler of Extended Events but is there any tool that can simulate traffic of e.g. 50 users? Or is there any way how can I multiple the saved trace from Profiler and replay it with a simulation of e.g. 50 users?</p>
<p>Thanks a lot</p>
",https://stackoverflow.com/questions/66370736/stress-testing-of-sql-server-analysis-services-tabular-model,"['ssas', 'performance-testing', 'profiler', 'ssas-tabular']",148,False,1,0
Best Practice to run 1k user for stress testing,"<p>Scenario: I wanted to login , get cookies and use that cookies as auth for other api GET request for 10k user.
I an using Ultimate thread group with following rows
Start Thread Count: 1000
Initial Delay sec : 0
Startup Time : 1000
Hold Load for : 300
Shutdown :0</p>
<p>Does it make any difference on sever If I used single user login or I need to need to use 1k login details ? , In that case as cookies are stored under browser local storage , so I am using web driver sampler to get that , so for 1k how will it be possible.</p>
<p>Similarly said by client to do for 10K 20k and so on .</p>
<p>As I am new , figuring out what is best possible way to get this done , am I on correct direction , kindly mentor me out .</p>
<p>Thanks</p>
",https://stackoverflow.com/questions/67242513/best-practice-to-run-1k-user-for-stress-testing,"['apache', 'jmeter']",26,False,0,1
Increasing load and hold time on a stress testing,"<p>I am conducting a stress testing for a web application. I have test scenario where I am testing functionality such as homepage , login and product catalogue and I am using a ultimate thread group. So I am increasing load for example with 100 user , initial delay 5 sec, startup time 50sec, hold time 3600sec and shut down time 50 sec. Is this a realistic stress test? And what matrices should I look and how should I examine them to make a decision? Thanks in advance!</p>
",https://stackoverflow.com/questions/68719286/increasing-load-and-hold-time-on-a-stress-testing,"['testing', 'jmeter']",104,True,0,1
FastAPI Gunicorn Uvicorn for Production Deployment with Google Cloud Run (Stress Testing),"<p>here I want to ask to you, what's the difference between running the gunicorn uvicorn with python, and default from tiangolo?</p>
<p>I have tried to stress testing these using <code>JMeter</code> with thread properties:</p>
<p><img src=""https://user-images.githubusercontent.com/58551053/108309910-0af1cb80-71e5-11eb-9a6d-d22e073e72ea.png"" alt=""Screenshot from 2021-02-18 12-29-26"" /></p>
<p>From these, I got the result::</p>
<p><img src=""https://user-images.githubusercontent.com/58551053/108309210-b8fc7600-71e3-11eb-9723-8de1f9dfcc3f.png"" alt=""Screenshot from 2021-02-18 12-20-05"" /></p>
<p>From above I have tried:</p>
<ol>
<li>Dockerfile with tiangolo base</li>
<li>Dockerfile with python:3.8-slim-buster and run it with gunicorn command</li>
<li>Dockerfile with python:3.8-slim-buster and run it with python</li>
</ol>
<p>This is my Dockerfile for case 1 (Tiangolo base):</p>
<pre><code>FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
RUN apt-get update &amp;&amp; apt-get install wget gcc -y
RUN mkdir -p /app
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY . /app
</code></pre>
<p>This is my Dockerfile for case 2 (Python base with gunicorn command):</p>
<pre><code>FROM python:3.8-slim-buster as builder
RUN apt-get update --fix-missing
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libgl1-mesa-dev python3-pip git
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -U setuptools
RUN pip3 install --upgrade pip
RUN pip3 install -r ./requirements.txt
COPY . /usr/src/app
ENTRYPOINT gunicorn --bind :8080 --workers 1 --threads 8 main:app --worker-class uvicorn.workers.UvicornH11Worker --preload --timeout 60 --worker-tmp-dir /dev/shm
</code></pre>
<p>This is my Dockerfile for case 3 (Python base with python command):</p>
<pre><code>FROM python:3.8-slim-buster
RUN apt-get update --fix-missing
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libgl1-mesa-dev python3-pip git
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -U setuptools
RUN pip3 install --upgrade pip
RUN pip3 install -r ./requirements.txt --use-feature=2020-resolver
COPY . /usr/src/app
CMD [&quot;python3&quot;, &quot;/usr/src/app/main.py&quot;]
</code></pre>
<p>Here I am confused, from the results above it looks like they have fairly the same results, what is the difference between the three methods above? which one is the best for production? I'm sorry, I'm new here in the production deployment API. I need some advice on this case. Thank you</p>
<p>This is my Cloud Run command</p>
<pre class=""lang-sh prettyprint-override""><code>gcloud builds submit --tag gcr.io/gaguna3/priceengine

gcloud run deploy backend-pure-python \
    --image=&quot;gcr.io/gaguna3/priceengine&quot; \
    --region asia-southeast2 \
    --allow-unauthenticated \
    --platform managed \
    --memory 4Gi \
    --cpu 2 \
    --timeout 900 \
    --project=gaguna3
</code></pre>
",https://stackoverflow.com/questions/66254371/fastapi-gunicorn-uvicorn-for-production-deployment-with-google-cloud-run-stress,"['gunicorn', 'fastapi', 'stress-testing', 'uvicorn']",23074,True,15,2
Stress testing Keycloak with Jmeter resulted in 100% CPU usage,"<p>Stress testing Keycloak with Jmeter resulted in 100% CPU usage.</p>
<p>I  have a Keycloak server, and I need to test it with 1,000 people logging at the same time to get OAuth Tokens.</p>
<p><a href=""https://i.stack.imgur.com/YlxoT.jpg"" rel=""nofollow noreferrer"">enter image description here</a>
<a href=""https://i.stack.imgur.com/XwGir.jpg"" rel=""nofollow noreferrer"">enter image description here</a></p>
<p>However, after testing, it was found that as long as there are more than 70 users login in at the same time, the CPU usage of the server where the Keycloak is set up will reach 100%.</p>
<p>It resulting a long response time of the api of login Keycloak server get token. It can even reach 10-20 seconds when there are 1000 people.</p>
<p><a href=""https://i.stack.imgur.com/drKtT.jpg"" rel=""nofollow noreferrer"">enter image description here</a></p>
<p>I originally thought that OAuth Server would all like this, but when I  testing with Identity Server did not have this problem.</p>
<p>Would anyone have a solution? Thanks a lot.</p>
",https://stackoverflow.com/questions/69795003/stress-testing-keycloak-with-jmeter-resulted-in-100-cpu-usage,"['java', 'jmeter', 'jboss', 'wildfly', 'keycloak']",1210,True,1,1
Random Connection Refused Responses During Stress Testing with Apache Jmeter,"<p>I have the Apache J Meter Tool on my pc and i am trying to stress my App being deployed on GKE.</p>
<p>Sending some requests concurrently or sequentially i am noticing a wired performance.</p>
<p>For example if i make 100 requests at one of the endpoints ,while the most of the requests are successful, 3 or 4 requests from 100 may return the following message:</p>
<pre><code>org.apache.http.conn.HttpHostConnectException: Connect to 35.246.108.130:31225 [/35.246.108.130] failed: Connection refused: connect
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$JMeterDefaultHttpClientConnectionOperator.connect(HTTPHC4Impl.java:404)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:935)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:646)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
    ... 19 more
</code></pre>
<p><a href=""https://i.stack.imgur.com/6tUNh.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/6tUNh.png"" alt=""enter image description here"" /></a>
Also, the number of requests returning errors may be different (smaller or bigger) if the tests are conducted by a different host machine.</p>
<p>Any ideas about what may cause this problem?</p>
",https://stackoverflow.com/questions/67618286/random-connection-refused-responses-during-stress-testing-with-apache-jmeter,['jmeter'],258,False,0,1
Stress-testing with artillery - Getting an auth0 bearer token using login flow,"<p>I want to use <a href=""https://artillery.io"" rel=""nofollow noreferrer"">artillery.io</a> as a stress-testing tool, and want to setup a basic stress-test. But all my url's are behind an auth wall (using Auth0) and I want to try to get a valid token for the testing session so that my backend does not throw me into a 401-spiral. The artillery docs explains that I can hook up to some lifecycle events using <code>processor</code>, but does not explain which lifecycle hooks I have available. I've managed to figure out that there is a <code>beforeRequest</code> hook I can use, but this does not seem optimal as this will probably run before every request. My tokens have at least an hour validity...</p>
<p><strong>So the main question is;</strong> how do I construct a processor hook which taps into the auth0 login flow, retreives a token which can then be stored in an environment variable (or some other local mechanism) for use as an Authorization Bearer token in future requests done by artillery?</p>
<p>OR if this is a bad pattern to follow, what is the best practice for urls behind auth-walls? I've already thought about loging in first and then copying the token to an environment variable and use that, but this makes the test a bit harder to use since it requires a manual step.</p>
<p>Any input is greatly appreciated.</p>
",https://stackoverflow.com/questions/67073439/stress-testing-with-artillery-getting-an-auth0-bearer-token-using-login-flow,"['auth0', 'artillery']",266,False,1,0
Compare QuantLib bond pricing with Excel functions YIELD and PRICE when doing stress testing,"<p>I calculated bond price and stressed bond price (shocking up yield) in both Excel and Python Quantlib. As the following table shows, weird results were generated: base bond price matches well between Excel and Quantlib but the stressed bond prices have more gaps (1.5% relative difference). Yields also show some gaps.
Can you please provide some comments?
<a href=""https://i.stack.imgur.com/oGtrJ.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/oGtrJ.png"" alt=""enter image description here"" /></a></p>
<p>Excel Code:</p>
<pre><code>    Base Bond Price=PRICE(&quot;2021-8-19&quot;,&quot;2025-8-19&quot;,4.5%,YIELD(&quot;2021-8-19&quot;,&quot;2025-8- 
   19&quot;,4.5%,95,100,4,0),100,4,0)

    Stress Bond Price=PRICE(&quot;2021-8-19&quot;,&quot;2025-8-19&quot;,4.5%,YIELD(&quot;2021-8-19&quot;,&quot;2025-8- 
   19&quot;,4.5%,95,100,4,0)+662/10000,100,4,0)
</code></pre>
<p>Python code:</p>
<pre><code>    import datetime
    import QuantLib as ql
    settlement_date = ql.Date(19,8,2021)
    valuation_date = ql.Date(19,8,2021)
    issue_date = ql.Date(19,8,2021)
    maturity_date = ql.Date(19,8,2025)
    tenor = ql.Period(4)
    calendar = ql.UnitedStates()
    business_convention = ql.Following
    date_generation = ql.DateGeneration.Backward
    end_month = False
    face_value = 100
    coupon_rate = 450/10000
    day_count = ql.Thirty360(ql.Thirty360.USA)
    redemption_value = 100
    schedule = ql.Schedule(issue_date, maturity_date, tenor, calendar, business_convention, business_convention, date_generation, end_month)
    bond = ql.FixedRateBond(settlement_date-valuation_date, face_value, schedule, [coupon_rate], day_count, business_convention, redemption_value, issue_date)
    target_price = 95
    bond_yield = bond.bondYield(target_price, day_count, ql.Compounded, 4, ql.Date(), 1.0e-8,1000)
    bond_price = bond.cleanPrice(bond_yield, day_count, ql.Compounded, 4)
    STRESS = 662
    stress_bond_yield = bond_yield+STRESS/10000
    
    stress_bond_price = bond.cleanPrice(stress_bond_yield, day_count, ql.Compounded, 4)
    excel_base_bond_price = 99.50
    excel_stress_bond_price = 75.02971569
    print('Base bond price from excel is', excel_base_bond_price )
    print('Base bond price from Quantlib is', bond_price)
    print('Stressed bond price from excel is',excel_stress_bond_price)
    print('Stressed bond price from Quantlib is',stress_bond_price)
</code></pre>
",https://stackoverflow.com/questions/70040693/compare-quantlib-bond-pricing-with-excel-functions-yield-and-price-when-doing-st,"['excel', 'quantlib']",452,True,0,1
Load generator in stress testing,"<p>Is it necessary to have load generator in stress testing. I am stress testing a e-commerce website and in my case I think I don't need run more that 300 virtual users. This amount of users I can run from JMeter non-gui mode. Is this will efficient? Thanks.</p>
",https://stackoverflow.com/questions/68769061/load-generator-in-stress-testing,"['testing', 'jmeter', 'blazemeter']",124,True,0,1
How to perform a search operation test in jmeter,"<p>I am trying to conduct a stress testing and I need to test the search operation of the web application. So I recorded the search operation using Blazemeter. <a href=""https://i.stack.imgur.com/1KeBU.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/1KeBU.png"" alt=""enter image description here"" /></a>. In the image I have three sampler recorded. So there are two get and one post request. But I am not sure should I keep them all for testing or only the sampler query request? Also is this the right way to do it because I will be doing stress testing on the website? Please give me your advise. thanks!!</p>
",https://stackoverflow.com/questions/68815888/how-to-perform-a-search-operation-test-in-jmeter,"['testing', 'jmeter', 'blazemeter']",267,False,0,1
ModuleNotFoundError: No module named &#39;locust.events&#39;,"<p>I'm a newbie of *python coding and I have faced a problem using <a href=""https://github.com/salgieri/rasa-locust-stress-test"" rel=""nofollow noreferrer"">locust based code</a> which is a stress testing tool for rasa socketio channel. I've proceeded as per the <a href=""https://github.com/salgieri/rasa-locust-stress-test#readme"" rel=""nofollow noreferrer"">README file</a> of stress testing tool and tried to fire up locust (pip installed locust) without doing any changes (only rasa_socket.py -&gt; ws_url variable is configured).
When I try to run locust using this command,</p>
<pre><code>locust --host=https://XXXXXXXXXXX.ngrok.io --locustfile rasa_socket.py --port=80
</code></pre>
<p>it pops up the following error in the cmd (I'm using a windows 10 OS, locust version 1.4.3). It says 'locust.events' not found.</p>
<pre><code>Traceback (most recent call last):


File &quot;c:\program files\python\lib\runpy.py&quot;, line 193, in _run_module_as_main
    &quot;__main__&quot;, mod_spec)
  File &quot;c:\program files\python\lib\runpy.py&quot;, line 85, in _run_code
    exec(code, run_globals)
  File &quot;D:\Tools\rasa socket load tester\load-test-venv\Scripts\locust.exe\__main__.py&quot;, line 7, in &lt;module&gt;
  File &quot;d:\tools\rasa socket load tester\load-test-venv\lib\site-packages\locust\main.py&quot;, line 125, in main
    docstring, user_classes, shape_class = load_locustfile(locustfile)
  File &quot;d:\tools\rasa socket load tester\load-test-venv\lib\site-packages\locust\main.py&quot;, line 81, in load_locustfile
    imported = source.load_module()
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 407, in _check_name_wrapper
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 907, in load_module
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 732, in load_module
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 265, in _load_module_shim
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 696, in _load
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 677, in _load_unlocked
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 728, in exec_module
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
  File &quot;D:\Tools\rasa socket load tester\rasa-locust-stress-test\rasa_socket.py&quot;, line 2, in &lt;module&gt;
    from locust.events import request_success
ModuleNotFoundError: No module named 'locust.events'
</code></pre>
<p>rasa_socket.py file is as follows; What am I doing wrong here...?</p>
<pre><code>from locust import HttpLocust, TaskSet, task, between
from locust.events import request_success
import socketio
import time
import random


class UserBehavior(TaskSet):
    statements = ['Can i buy toliet rolls', 'Can I come and visit the store', 'when can I visit the store',
                  'I need more medicine']

    def on_start(self):
        sio = socketio.Client()
        ws_url = &quot;https://XXXXXXXXXXX.ngrok.io/socket.io/&quot;
        sio.connect(ws_url, transports=&quot;polling&quot;)
        self.ws = sio
        self.user_id = sio.sid
        # body = json.dumps([&quot;session_confirm&quot;, self.user_id])
        body = '{&quot;session_request&quot;, {&quot;session_id&quot;: &quot;' + self.user_id + '&quot;}}'
        self.ws.emit(body)

    def on_quit(self):
        self.ws.disconnect()

    @task(1)
    def say_hello(self):
        start_at = time.time()

        body = {&quot;message&quot;: &quot;Hello&quot;, &quot;customData&quot;: {&quot;language&quot;: &quot;en&quot;}, &quot;session_id&quot;: self.user_id}

        # self.ws.send(body)
        self.ws.emit('user_uttered', data=body)

        request_success.fire(
            request_type='WebSocket Sent',
            name='test/ws/echo',
            response_time=int((time.time() - start_at) * 1000000),
            response_length=len(body),
        )

    @task(2)
    def say_random(self):
        start_at = time.time()

        statement = random.choice(self.statements)

        body = {&quot;message&quot;: statement, &quot;customData&quot;: {&quot;language&quot;: &quot;en&quot;}, &quot;session_id&quot;: self.user_id}

        # self.ws.send(body)
        self.ws.emit('user_uttered', data=body)

        request_success.fire(
            request_type='WebSocket Sent',
            name='test/ws/echo',
            response_time=int((time.time() - start_at) * 1000000),
            response_length=len(body),
        )


class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    wait_time = between(5, 15)

# 5c57023864bc4cf4bf82cf370d1b9349
# 0484184e70fa11eaad0ca45e60dc2e59
</code></pre>
",https://stackoverflow.com/questions/66916044/modulenotfounderror-no-module-named-locust-events,"['python', 'locust', 'rasa', 'modulenotfounderror']",1572,False,1,0
Min Instance Google Cloud Run,"<p>What if I set my <code>minimum instance</code> to 1, 4, 10. What is the difference between minimum instances 1, 4, and 10?
I'm curious about this one, because when I stress testing it. I didn't see any difference from this?</p>
<p>Is it only effect only in first-time HTTP Request?</p>
",https://stackoverflow.com/questions/66347715/min-instance-google-cloud-run,"['google-cloud-platform', 'instance', 'google-cloud-run', 'stress-testing']",1791,True,2,1
Spring Data Neo4j: Unable to acquire connection from the pool within configured maximum time,"<p>I am doing stress testing of my Neo4j client which is built using <strong>spring-boot-starter-data-neo4j</strong>.</p>
<p>After sometime passed, application throwing error Unable to acquire connection for any request.</p>
<p>This is my bean configuration for Neo4j connection. can someone check and tell what can be done</p>
<pre><code>id(&quot;org.springframework.boot&quot;) version &quot;2.4.0&quot;



@Configuration
    @EnableTransactionManagement
    class Neo4jConfig(
        @Value(&quot;\${spring.neo4j.uri}&quot;)
        val neo4jDBUri: String,

        @Value(&quot;\${spring.neo4j.authentication.username}&quot;)
        val neo4jDbUserName: String,

        @Value(&quot;\${spring.neo4j.authentication.password}&quot;)
        val neo4jDbUserPassword: String
    ) : AbstractNeo4jConfig() {
//        https://medium.com/neo4j/try-and-then-retry-there-can-be-failure-30bf336383da
        @Bean
        override fun driver(): Driver {
            val config: Config = Config.builder()
                .withMaxTransactionRetryTime(60, TimeUnit.SECONDS)
                .withLeakedSessionsLogging()
                .withRoutingTablePurgeDelay(1, TimeUnit.SECONDS)
                .withConnectionAcquisitionTimeout(2 * 60, TimeUnit.SECONDS)
                .withConnectionLivenessCheckTimeout(2 * 60, TimeUnit.SECONDS)
                .withDriverMetrics()
                .withMaxConnectionPoolSize(100)
                .build()

            return GraphDatabase
                .driver(neo4jDBUri, AuthTokens.basic(neo4jDbUserName, neo4jDbUserPassword), config)
        }
    }

    // Refer: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4.0-M2-Release-Notes#neo4j-1
    @Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
    fun reactiveTransactionManager(
        driver: Driver,
        databaseNameProvider: ReactiveDatabaseSelectionProvider
    ): ReactiveTransactionManager = ReactiveNeo4jTransactionManager(driver, databaseNameProvider)

    // Refer: https://hantsy.medium.com/data-auditing-with-spring-data-neo4j-11d6461146ff
    @Configuration(proxyBeanMethods = false)
    @EnableReactiveNeo4jAuditing
    internal class DataConfig {
        @Bean
        fun reactiveAuditorAware(): ReactiveAuditorAware&lt;String&gt; = ReactiveAuditorAware { Mono.just(&quot;Audit enabled&quot;) }
    }
</code></pre>
<p>Error message</p>
<pre><code>webFilters.ControllerConfig in Neo4jDriverIO-2-2 - Returning HTTP 400 Bad Requestorg.springframework.dao.InvalidDataAccessResourceUsageException: Unable to acquire connection from the pool within configured maximum time of 120000ms; Error code 'N/A'   at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105)    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s):    |_ checkpoint ⇢ Handler 

controller.UserApiController#createUser(UserReqModel, Continuation) [DispatcherHandler]Stack trace:     at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105)        at org.springframework.data.neo4j.repository.support.Neo4jPersistenceExceptionTranslator.translateExceptionIfPossible(Neo4jPersistenceExceptionTranslator.java:91)      at org.springframework.data.neo4j.core.DefaultReactiveNeo4jClient.potentiallyConvertRuntimeException(DefaultReactiveNeo4jClient.java:271)       at org.springframework.data.neo4j.core.DefaultReactiveNeo4jClient.access$200(DefaultReactiveNeo4jClient.java:54)        at org.springframework.data.neo4j.core.DefaultReactiveNeo4jClient$DefaultRecordFetchSpec.la
</code></pre>
",https://stackoverflow.com/questions/65598583/spring-data-neo4j-unable-to-acquire-connection-from-the-pool-within-configured,"['spring-boot', 'neo4j', 'spring-data-neo4j']",410,False,1,0
How do I add bearer token to JMeter,"<p>I have come from PostMan now using JMeter for stress testing, I have a POST method that works great with PostMan yet I can't seem to get the bearer token authenticating to work on JMeter. I have the same token in PostMan as JMeter (See Screenshots)</p>
<p>Any help or advice is appreciated. See screenshots:</p>
<p><a href=""https://i.stack.imgur.com/vfDtz.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/vfDtz.png"" alt=""enter image description here"" /></a></p>
<p><a href=""https://i.stack.imgur.com/k6Tw9.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/k6Tw9.png"" alt=""enter image description here"" /></a></p>
<p><a href=""https://i.stack.imgur.com/3I780.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/3I780.png"" alt=""enter image description here"" /></a></p>
<p><a href=""https://i.stack.imgur.com/dr6lR.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/dr6lR.png"" alt=""enter image description here"" /></a></p>
",https://stackoverflow.com/questions/66563564/how-do-i-add-bearer-token-to-jmeter,"['jmeter', 'postman']",4618,True,0,2
Is there any open source load generators?,"<p>I would like to know if there is any open source load generator for stress testing. I am using JMeter script to run the test. I know there is one called flood.io but think it is not free. Can you please recommend me some option and documentation on how to use it properly? Thanks!!</p>
",https://stackoverflow.com/questions/68770714/is-there-any-open-source-load-generators,"['testing', 'jmeter', 'blazemeter']",34,True,-1,1
Best method to bulk load (5 millions) into Janusgraph,"<p>Doing some stress testing on Janusgraph and required to load est 5 million vertex and edges. Using faker python to generate the fake data and will like to know which is the best method to load such bulk chuck of data? I tried to load the data using the console but getting weird results and timeout.</p>
",https://stackoverflow.com/questions/66933444/best-method-to-bulk-load-5-millions-into-janusgraph,"['gremlin', 'janusgraph', 'gremlinpython']",217,True,1,1
python open error return&quot;FileNotFoundError: [Errno 2] No such file or directory: &quot;,"<p>Recently I met a very odd bug when working with a <a href=""https://github.com/Freddy930727/sukebei-crawler-v2/tree/master/div"" rel=""nofollow noreferrer"">crawler</a>.
My script works well on almost every case. However, when I tried to execute stress testing(like crawling  1000 set of data)most of the data that I save as <code>.torrent</code> works without error, but one of which returns error.
Here is the script.</p>
<pre><code>temp=torrent_title
temp=temp[0:246:1]#maximum length of file name in win10
for tempa in range(len(temp)):
    if(temp[tempa] in '\/:*?&quot;&lt;&gt;|'):#special word that can't be named the name of a file in win10
        temp=temp.replace(temp[tempa],&quot; &quot;)
r=requests.get(url)                                
filename=temp+&quot;.torrent&quot;
while(not r.status_code==requests.codes.ok):
    r = requests.get(url, allow_redirects=True)
open(download_path+&quot;\\&quot;+filename, 'wb').write(r.content)
</code></pre>
<p>and error</p>
<pre><code> line 119, in main
    open(download_path+&quot;\\&quot;+filename, 'wb').write(r.content)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\C147\\Downloads\\sukebei-crawler-v2-master\\sukebei-crawler-v2-master\\div\\downloads\\08-04-2021_16-35-09\\+++ [HD] 459TEN-016 【性獣危険】Fカップ現役女子大生の自宅に突撃！！とっておきの勝負下着で悩殺ファック！！『人類みなセフレ』！！触れる者みなSEXするとんでもない性獣を捕まえてしまいました！！完全にコントロール不可能のバーサーカービッチにデカチン3人を投入して無限絶頂させまくる！！！イラマと無限ピストンで快楽のその向こう側へ…【性豪ギャル自宅中出し】勝負下着、見せちゃいます！vol.13.torrent'
</code></pre>
<p>By the way,this script is execute on win10.</p>
",https://stackoverflow.com/questions/67007487/python-open-error-returnfilenotfounderror-errno-2-no-such-file-or-directory,"['python', 'windows', 'beautifulsoup', 'python-requests', 'web-crawler']",2527,True,0,1
Push docker image to another container registry with compose,"<p>I am running locust (the official image from Docker Hub) locally using a Docker-compose file as below</p>
<pre><code>version: '3'

services:
  locust:
    image: locustio/locust
    ports:
     - &quot;8089:8089&quot;
    volumes:
      - ./:/mnt/locust
    command: -f /mnt/locust/locustfile.py -H https://my-host-url.com
</code></pre>
<p>I have done the stress-testing in my local with <code>docker-compose up</code>. The next step is to push this compose file onto another registry. I am following the steps given in docker hub documentation. However, I just need some help in copying the necessary locustfile.py as well to my other registry (let's say artifactory).</p>
",https://stackoverflow.com/questions/67727455/push-docker-image-to-another-container-registry-with-compose,"['docker', 'docker-compose', 'docker-image', 'locust']",1500,True,1,1
correcting java code for more scalability,"<p>I am using a spring-boot application and fasterxml for deserializing my request. While stress testing my java application using jmeter many nio threads are going into TIMED_WAITING state.The statement on which they are waiting is,
<code>mapper.readValue(request.getInputStream(), MyRequest.class);</code></p>
<p>Below is the extract from thread-dump,</p>
<pre><code>&quot;http-nio-8080-exec-1415&quot; #88733 daemon prio=5 os_prio=0 tid=0x00007f98c03d1800 nid=0x2240f in Object.wait() [0x00007f9744dcb000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1244)
    - locked &lt;0x00000007762846e0&gt; (a java.util.concurrent.Semaphore)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1158)
    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:736)
    at org.apache.coyote.http11.Http11InputBuffer.access$300(Http11InputBuffer.java:42)
    at org.apache.coyote.http11.Http11InputBuffer$SocketInputBuffer.doRead(Http11InputBuffer.java:1099)
    at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:102)
    at org.apache.coyote.http11.Http11InputBuffer.doRead(Http11InputBuffer.java:247)
    at org.apache.coyote.Request.doRead(Request.java:551)
    at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:336)
    at org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:632)
    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:362)
    at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:132)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._loadMore(UTF8StreamJsonParser.java:205)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._loadMoreGuaranteed(UTF8StreamJsonParser.java:2342)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2427)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2407)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:269)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:264)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeArray(JsonNodeDeserializer.java:434)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeObject(JsonNodeDeserializer.java:258)
    at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer.deserializeArray(JsonNodeDeserializer.java:434)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:70)
    at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:15)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4014)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3071)
    at com.myapp.controller.MyController.populate(PublishController.java:69)
    at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at com.myapp.security.SecurityFilter.doFilterInternal(SecurityOAuthFilter.java:174)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:97)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    - locked &lt;0x0000000776284588&gt; (a org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
</code></pre>
<p>Nearly 200 nio threads are in the same state. What could be done to make it the code more scalable so that we will get higher throughput.</p>
",https://stackoverflow.com/questions/67364717/correcting-java-code-for-more-scalability,"['java', 'spring-boot', 'tomcat', 'fasterxml']",318,True,0,1
Rasa Agent does not support more than 23 req/sec,"<p>As we were doing a stress testing of a Rasa Agen before deploying on the production, we encountered that it only supports 23 requests per second with a response time of 1 second.</p>
<p>If we try to increase the requests by more than 23, then the response time increases gradually; it becomes more than 5 seconds, regardless of its hardware.</p>
<p>Is there any way to eliminate this limit?</p>
<p>I am on Rasa version 2.1.2</p>
",https://stackoverflow.com/questions/67212733/rasa-agent-does-not-support-more-than-23-req-sec,['rasa'],269,True,3,1
Log all events in wxWidgets in the whole application?,"<p>I have a large application, with many dynamic parts/panels/widgets. Upon stress-testing, The GUI goes blank. I doubt that the GUI thread is bombarded with events from other threads.</p>
<p>I have disabled all the events that I doubted, but it still goes blank. So is there like a global handler or logger to log all the events that occur in the wxWidgets main loop ?</p>
<p>N.B: I have around 1000 threads.</p>
",https://stackoverflow.com/questions/67064291/log-all-events-in-wxwidgets-in-the-whole-application,['wxwidgets'],111,True,1,1
Increasing load and hold time on a stress testing,"<p>I am conducting a stress testing for a web application. I have test scenario where I am testing functionality such as homepage , login and product catalogue and I am using a ultimate thread group. So I am increasing load for example with 100 user , initial delay 5 sec, startup time 50sec, hold time 3600sec and shut down time 50 sec. Is this a realistic stress test? And what matrices should I look and how should I examine them to make a decision? Thanks in advance!</p>
",https://stackoverflow.com/questions/68719286/increasing-load-and-hold-time-on-a-stress-testing,"['testing', 'jmeter']",104,True,0,1
OutOfMemory instances in Heap Histogram,"<p>I have been doing stress testing for my application. In my analysis, I did found some OutOfMemory instances in heap histogram.</p>
<p><strong>726:            10            320  java.lang.OutOfMemoryError</strong></p>
<p>I didn't observe OutOfMemory issue in my application logs, and neither in thread stack. What does this indicate ? Did my application encounter OOM 10 times ?</p>
<p>Application startup command</p>
<p><em>CommandLine flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote -XX:+FlightRecorder -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/pmc/oom.hprof -XX:InitialHeapSize=134217728 -XX:+ManagementServer -XX:MaxHeapSize=805306368 -XX:NewRatio=1 -XX:+PrintClassHistogram -XX:-PrintConcurrentLocks -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UnlockCommercialFeatures -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC</em></p>
",https://stackoverflow.com/questions/68111796/outofmemory-instances-in-heap-histogram,"['java', 'garbage-collection', 'out-of-memory', 'heap-dump']",196,False,2,1
Difference between stress test and breakpoint test,"<p>I was looking for the verbal explanations of different performance testing types and saw a new one called &quot;breakpoint test&quot;. Its explanation seemed very similar to stress testing for me. So what is the difference, or is there any difference?</p>
<blockquote>
<p>Stress Test: A verification on the system performance during extremely
high load which is way above the peak load</p>
<p>Breakpoint Test: This test determines the point of system failure by
gradually increasing the number of simulated concurrent users.</p>
</blockquote>
<p>As far as I know, we increase the load gradually while performing stress test too. So what is the difference between this two type?</p>
",https://stackoverflow.com/questions/69722534/difference-between-stress-test-and-breakpoint-test,"['testing', 'performance-testing']",1411,True,1,2
Send an Active FTP Request to FTP Server via jmeter,"<p>I just started using <code>jmeter</code> to load test FTP Server.
I am aware that jmeter by default sends passive connection request to the FTP Server via the default <code>FTP Request sampler</code>.</p>
<p>I wanted to know what's the best and simplest way using which i can change the request to <code>active mode</code>.
I did find multiple posts about samplers but none of them were straight forward nor had clear steps on how to write your own sampler and run it.</p>
<p>If you have any suggestion for any other open source FTP Stress testing which support both passive and active requests. Please help me out.</p>
",https://stackoverflow.com/questions/65552881/send-an-active-ftp-request-to-ftp-server-via-jmeter,"['jmeter', 'ftp', 'load-testing', 'stress-testing']",366,False,0,1
How to design a stress test for e-commerce application with jmeter,"<p>I am conducting a stress testing for a web application but I am quite confused how should I design the test cycle. So I have a test script with few controllers for example homepage, login, product catalogue and a uniform random timer. But How long and how many time should I run the the stress test to make a proper decision. Also for example I am using ultimate thread group for testing and how many user should add each time and how long the ramp up, hold time and shutting time can be for a proper result? Thanks in advance!</p>
",https://stackoverflow.com/questions/68708825/how-to-design-a-stress-test-for-e-commerce-application-with-jmeter,"['testing', 'jmeter']",251,True,0,1
Using `async def` vs `def` in FastAPI and testing blocking calls,"<h2><code>tl;dr</code></h2>
<ol>
<li>Which of the options below is the correct workflow in <code>fastapi</code>?</li>
<li>How does one programatically test whether a call is truly blocking (other than manually from browser)? Is there a <em>stress testing</em> extension to <code>uvicorn</code> or <code>fastapi</code>?</li>
</ol>
<p>I have a number of endpoints in <code>fastapi</code> server (using <code>uvicorn</code> at the moment) that have long blocking calls to regular sync Python code. Despite the documentation (<a href=""https://fastapi.tiangolo.com/async/"" rel=""noreferrer"">https://fastapi.tiangolo.com/async/</a>) I am still unclear whether I should be using exclusively <code>def</code>, <code>async def</code> or mixing for my functions.</p>
<p>As far as I understand it, I have three options, assuming:</p>
<pre class=""lang-py prettyprint-override""><code>def some_long_running_sync_function():
  ...
</code></pre>
<h3>Option 1 - consistently use <code>def</code> only for endpoints</h3>
<pre class=""lang-py prettyprint-override""><code>@app.get(&quot;route/to/endpoint&quot;)
def endpoint_1:
  some_long_running_sync_function()


@app.post(&quot;route/to/another/endpoint&quot;)
def endpoint_2:
  ...
</code></pre>
<h3>Option 2 - consistently use <code>async def</code> only and run blocking sync code in executor</h3>
<pre class=""lang-py prettyprint-override""><code>import asyncio


@app.get(&quot;route/to/endpoint&quot;)
async def endpoint_1:
  loop = asyncio.get_event_loop()
  await loop.run_in_executor(None, some_long_running_sync_function)


@app.post(&quot;route/to/another/endpoint&quot;)
async def endpoint_2:
  ...
</code></pre>
<h3>Option 3 - mix and match <code>def</code> and <code>async def</code> based on underlying calls</h3>
<pre class=""lang-py prettyprint-override""><code>import asyncio


@app.get(&quot;route/to/endpoint&quot;)
def endpoint_1:
  # endpoint is calling to sync code that cannot be awaited
  some_long_running_sync_function()


@app.post(&quot;route/to/another/endpoint&quot;)
async def endpoint_2:
  # this code can be awaited so I can use async
  ...
</code></pre>
",https://stackoverflow.com/questions/70123888/using-async-def-vs-def-in-fastapi-and-testing-blocking-calls,"['python-asyncio', 'fastapi', 'uvicorn']",6118,True,9,1
innodb_buffer_pool and redis which is best?,"<p>both innodb_buffer_pool and redis they are all suppert memery. and they are all support LRU. so why should i use both redis and mysql at same time?, what's the point of using redis in my case.</p>
<p>my application is coding use golang(game server). It provides http api. but applications are becoming more complex. it has 100 sql query per request (20% insert/update, 80% select).because the game hasn't been released yet so
the data set is small, about 400000 rows, stress testing in progress,i want to improving it. i increased innodb_buffer_pool_size,the performance improved but it didn't meet my expectations. so i want using redis.</p>
<p>thanks for you answer</p>
",https://stackoverflow.com/questions/69922412/innodb-buffer-pool-and-redis-which-is-best,"['mysql', 'database', 'redis', 'innodb']",146,True,0,1
FastAPI Gunicorn Uvicorn for Production Deployment with Google Cloud Run (Stress Testing),"<p>here I want to ask to you, what's the difference between running the gunicorn uvicorn with python, and default from tiangolo?</p>
<p>I have tried to stress testing these using <code>JMeter</code> with thread properties:</p>
<p><img src=""https://user-images.githubusercontent.com/58551053/108309910-0af1cb80-71e5-11eb-9a6d-d22e073e72ea.png"" alt=""Screenshot from 2021-02-18 12-29-26"" /></p>
<p>From these, I got the result::</p>
<p><img src=""https://user-images.githubusercontent.com/58551053/108309210-b8fc7600-71e3-11eb-9723-8de1f9dfcc3f.png"" alt=""Screenshot from 2021-02-18 12-20-05"" /></p>
<p>From above I have tried:</p>
<ol>
<li>Dockerfile with tiangolo base</li>
<li>Dockerfile with python:3.8-slim-buster and run it with gunicorn command</li>
<li>Dockerfile with python:3.8-slim-buster and run it with python</li>
</ol>
<p>This is my Dockerfile for case 1 (Tiangolo base):</p>
<pre><code>FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
RUN apt-get update &amp;&amp; apt-get install wget gcc -y
RUN mkdir -p /app
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY . /app
</code></pre>
<p>This is my Dockerfile for case 2 (Python base with gunicorn command):</p>
<pre><code>FROM python:3.8-slim-buster as builder
RUN apt-get update --fix-missing
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libgl1-mesa-dev python3-pip git
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -U setuptools
RUN pip3 install --upgrade pip
RUN pip3 install -r ./requirements.txt
COPY . /usr/src/app
ENTRYPOINT gunicorn --bind :8080 --workers 1 --threads 8 main:app --worker-class uvicorn.workers.UvicornH11Worker --preload --timeout 60 --worker-tmp-dir /dev/shm
</code></pre>
<p>This is my Dockerfile for case 3 (Python base with python command):</p>
<pre><code>FROM python:3.8-slim-buster
RUN apt-get update --fix-missing
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libgl1-mesa-dev python3-pip git
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -U setuptools
RUN pip3 install --upgrade pip
RUN pip3 install -r ./requirements.txt --use-feature=2020-resolver
COPY . /usr/src/app
CMD [&quot;python3&quot;, &quot;/usr/src/app/main.py&quot;]
</code></pre>
<p>Here I am confused, from the results above it looks like they have fairly the same results, what is the difference between the three methods above? which one is the best for production? I'm sorry, I'm new here in the production deployment API. I need some advice on this case. Thank you</p>
<p>This is my Cloud Run command</p>
<pre class=""lang-sh prettyprint-override""><code>gcloud builds submit --tag gcr.io/gaguna3/priceengine

gcloud run deploy backend-pure-python \
    --image=&quot;gcr.io/gaguna3/priceengine&quot; \
    --region asia-southeast2 \
    --allow-unauthenticated \
    --platform managed \
    --memory 4Gi \
    --cpu 2 \
    --timeout 900 \
    --project=gaguna3
</code></pre>
",https://stackoverflow.com/questions/66254371/fastapi-gunicorn-uvicorn-for-production-deployment-with-google-cloud-run-stress,"['gunicorn', 'fastapi', 'stress-testing', 'uvicorn']",23074,True,15,2
AWS lambda to Confluent Cloud latency issues,"<p>I am currently using basic version of cluster on Confluent cloud and I only have one topic with 9 partitions. I have a REST Api that’s setup using AWS lambda service which publishes messages to Kafka.
Currently i am stress testing pipeline with 5k-10k requests per second, I found that Latency is shooting up to 20-30 seconds to publish a record of size 1kb. Which is generally 300 ms for a single request.
I added producer configurations like linger.ms - 500 ms and batch.size to 100kb. I see some improvement (15-20 seconds per request) but I feel it’s still too high.
Is there anything that I am missing or is it something with the basic cluster on confluent cloud? All of the configurations on the cluster were default.</p>
",https://stackoverflow.com/questions/67829974/aws-lambda-to-confluent-cloud-latency-issues,"['amazon-web-services', 'apache-kafka', 'confluent-platform', 'confluent-kafka-python', 'confluent-cloud']",223,True,0,1
How to stress test Reactive Web APIs?,"<p>We have migrated/refactored one of our micro-service from request per thread model (sync) to Reactive (async). Development is complete and started stress testing the <strong>reactive</strong> service. We are looking for the help on how to perform the activity for reactive APIs</p>
<p><strong>What we have done?</strong></p>
<p>Our service makes HTTP call for an external service. During our stress test, we mocked the external service call. Instead of making a network call, we introduced delay using <code>Thread.sleep()</code> method and returning mock response in our service component(where we make actual HTTP call to the external service).</p>
<p>With this approach, we are observing our <strong>reactive</strong> service is getting <strong>crashed</strong> even with very small requests volume. Just to add, we follow similar approach while testing other sync services (request per thread model).</p>
<p>What can we try next?</p>
",https://stackoverflow.com/questions/67224785/how-to-stress-test-reactive-web-apis,"['spring-webflux', 'webclient', 'project-reactor', 'stress-testing', 'spring-webclient']",502,True,0,2
Stress testing Keycloak with Jmeter resulted in 100% CPU usage,"<p>Stress testing Keycloak with Jmeter resulted in 100% CPU usage.</p>
<p>I  have a Keycloak server, and I need to test it with 1,000 people logging at the same time to get OAuth Tokens.</p>
<p><a href=""https://i.stack.imgur.com/YlxoT.jpg"" rel=""nofollow noreferrer"">enter image description here</a>
<a href=""https://i.stack.imgur.com/XwGir.jpg"" rel=""nofollow noreferrer"">enter image description here</a></p>
<p>However, after testing, it was found that as long as there are more than 70 users login in at the same time, the CPU usage of the server where the Keycloak is set up will reach 100%.</p>
<p>It resulting a long response time of the api of login Keycloak server get token. It can even reach 10-20 seconds when there are 1000 people.</p>
<p><a href=""https://i.stack.imgur.com/drKtT.jpg"" rel=""nofollow noreferrer"">enter image description here</a></p>
<p>I originally thought that OAuth Server would all like this, but when I  testing with Identity Server did not have this problem.</p>
<p>Would anyone have a solution? Thanks a lot.</p>
",https://stackoverflow.com/questions/69795003/stress-testing-keycloak-with-jmeter-resulted-in-100-cpu-usage,"['java', 'jmeter', 'jboss', 'wildfly', 'keycloak']",1210,True,1,1
Extracting value from Json response of POST request in Jmeter using Json Extractor,"<p><a href=""https://i.stack.imgur.com/iyHc3.png"" rel=""nofollow noreferrer"">Post request</a> <a href=""https://i.stack.imgur.com/F5KaC.png"" rel=""nofollow noreferrer"">Json Extractor</a> <a href=""https://i.stack.imgur.com/SviGX.png"" rel=""nofollow noreferrer"">Get request</a> <a href=""https://i.stack.imgur.com/nVolH.png"" rel=""nofollow noreferrer"">debug sampler</a> <a href=""https://i.stack.imgur.com/xOLZo.png"" rel=""nofollow noreferrer"">error message</a> I'm using Jmeter for stress testing of my application. Test plan that I'm building has a POST request which creates a user and the next PATCH request updates it. Basically I want to extract user_id from Json response received after POST request and add that id in the body of the next request. For that I use Json extractor in my POST request and when I check Debug Sampler the value is successfully stored. But when I try to use extracted user_id in any subsequent requests of the same thread it is not recognized. However when I tried to extract user_id of already created user with GET request then this user_id is normally recognized by other requests. I'm not sure whether Json extractor is not normally used with POST requests or I'm doing something wrong.</p>
",https://stackoverflow.com/questions/67950428/extracting-value-from-json-response-of-post-request-in-jmeter-using-json-extract,"['json', 'jmeter']",455,True,1,1
Is it a good practice to use variables scope for defining constants in Coldfusion?,"<p>In our Adobe Coldfusion project we have some components used as singletons such as this one:</p>
<pre><code>component name=&quot;Util&quot; {
    public function init() {
        variables.settings = loadFromConig();
        variables.prefix = &quot;my_&quot;;
        return this;
    }

    public string function getPrefix() {
        return variables.prefix;
    }

    public struct function getSettings() {
        return variables.settings;
    }
}
</code></pre>
<p>This should normally work because the init() function must always be executed first in order to be able to call any other method.
My concern is: is there any risk that this does not happen as expected (for example under stress testing conditions) if the loadFromConig() function takes too long and some getter method throws an undefined variable exception?</p>
<p>In general, is it a good practice to define some 'constants' using the variables' scope in the constructor (Method A) or is it better to use <em><strong>properties</strong></em> with default values instead (Method B) or is it safer to hardcode the 'constants' in the getters directly:</p>
<pre><code>public string function getPrefix() {
   return &quot;my_&quot;;
}
</code></pre>
<p>(Method C)?</p>
<p>I we use Method A - is it a good idea to put a cflock around these lines:</p>
<pre><code>  variables.settings = loadFromConig();
  variables.prefix = &quot;my_&quot;;
</code></pre>
<p>in the Constructor or would such a lock be useless?</p>
",https://stackoverflow.com/questions/66521582/is-it-a-good-practice-to-use-variables-scope-for-defining-constants-in-coldfusio,"['constructor', 'constants', 'singleton', 'adobe', 'coldfusion-2018']",50,True,1,1
"How to make springboot app run on -Xmx450m this jvm param throws OutOfMemoryError , currently its not comming below -Xmx1000m in heroku","<p>I am trying to run my springboot on memory constraint machine of heroku-free.
Heroku says you need to keep you -Xmx300m, but we can pass parameter till 512m as that is the upper limit.</p>
<p>The problem is that i am stuck, no matter how minimal i make my app it needs postgrese and redis connection and its using ateleast -Xmx1000m, i even tried some variation with introducing some GC still no luck. Below are the jvm params needed curretly to make my app work,(note:i haven't done any stress testing):</p>
<pre><code>-Xmx1000m -Xms384m -Xss512k -XX:+UseCompressedOops -XX:+UseG1GC
</code></pre>
<p>i have even given added <code>server.tomcat.max-threads = 1</code> in <code>application.properties</code> no luck.</p>
<p>I need to run my app on below jvm params, Any help would be greatly appreciated</p>
<pre><code>-Xmx450m -Xms384m -Xss512k -XX:+UseCompressedOops 
</code></pre>
<p>With the above jvm param,app starts but if you make any api hit  throws below error
UPDATE:</p>
<pre><code>   java.lang.OutOfMemoryError: Java heap space
        at java.io.ByteArrayOutputStream.&lt;init&gt;(ByteArrayOutputStream.java:77) ~[na:1.8.0_131]
        at org.springframework.web.util.ContentCachingRequestWrapper.&lt;init&gt;(ContentCachingRequestWrapper.java:88) ~[spring-web-5.3.8.jar!/:5.3.8]
        at org.springframework.web.filter.AbstractRequestLoggingFilter.doFilterInternal(AbstractRequestLoggingFilter.java:281) ~[spring-web-5.3.8.jar!/:5.3.8]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar!/:5.3.8]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at com.app.x.security.JwtTokenFilter.doFilter(JwtTokenFilter.java:46) ~[classes!/:0.0.1-SNAPSHOT]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) ~[spring-web-5.3.8.jar!/:5.3.8]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar!/:5.3.8]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.5.1.jar!/:5.5.1]
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.5.1.jar!/:5.5.1]
</code></pre>
<p>further i was able to drill down to HeadWritterFilter.class this is part of springSecurity token verification</p>
<pre><code>void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
    Iterator var3 = this.headerWriters.iterator();  //there are 5 values here
while(var3.hasNext()) {
    HeaderWriter writer = (HeaderWriter)var3.next();
    writer.writeHeaders(request, response);             //fails on the last value
}
</code></pre>
<p>}</p>
",https://stackoverflow.com/questions/68812212/how-to-make-springboot-app-run-on-xmx450m-this-jvm-param-throws-outofmemoryerro,"['java', 'spring-boot', 'heroku', 'out-of-memory', 'heap-memory']",140,False,0,1
C++ | How to prevent my code from essentially increasing the value of my integers/values?,"<p>Just in case the title wasn't descriptive enough, I wrote a basic calculator as a beginner and after random stress-testing and experimenting trying to find bugs, I found something that results in the following as an example.</p>
<blockquote>
<p>Would you like to add, subtract, multiply, divide, or use powers? (A,S,M,D,P)<br />
D<br />
What integer would you like to start with?<br />
48834343<br />
What would you like to divide 48834343 by?<br />
34923499234<br />
48834343 divided by 3.49235e+10 is equal to 0.00139832</p>
</blockquote>
<p>The code is somehow shifting the decimal over or just multiplying it by a random multiple of 10. I have tried using different variable types which seemed to fix it a little bit but when you start increasing the character count of the number(s), the more it seems to break with most variable types. I'm probably missing something since I'm a beginner, so don't hold anything back in any explanation as far as criticism goes, but please ELI5.</p>
<p>Enough chitchat, here's the code</p>
<pre><code>#include&lt;iostream&gt;
#include&lt;math.h&gt;
using namespace std;

void add() {
    cout &lt;&lt; &quot;What integer would you like to start with?\n&quot;;
    int x;
    cin &gt;&gt; x;
    cout &lt;&lt; &quot;What would you like to add to &quot; &lt;&lt; x &lt;&lt; &quot;?\n&quot;;
    int y;
    cin &gt;&gt; y;
    cout &lt;&lt; x &lt;&lt; &quot; plus &quot; &lt;&lt; y &lt;&lt; &quot; is equal to &quot; &lt;&lt; x + y;
}

void subt() {
    cout &lt;&lt; &quot;What integer would you like to start with?\n&quot;;
    int x;
    cin &gt;&gt; x;
    cout &lt;&lt; &quot;What would you like to subtract from &quot; &lt;&lt; x &lt;&lt; &quot;?\n&quot;;
    int y;
    cin &gt;&gt; y;
    cout &lt;&lt; x &lt;&lt; &quot; minus &quot; &lt;&lt; y &lt;&lt; &quot; is equal to &quot; &lt;&lt; x - y;
}

void mult() {
    cout &lt;&lt; &quot;What integer would you like to start with?\n&quot;;
    double x;
    cin &gt;&gt; x;
    cout &lt;&lt; &quot;What would you like to multiply &quot; &lt;&lt; x &lt;&lt; &quot; by?\n&quot;;
    double y;
    cin &gt;&gt; y;
    cout &lt;&lt; x &lt;&lt; &quot; times &quot; &lt;&lt; y &lt;&lt; &quot; is equal to &quot; &lt;&lt; x * y;
}

void divd() {
    cout &lt;&lt; &quot;What integer would you like to start with?\n&quot;;
    int x;
    cin &gt;&gt; x;
    cout &lt;&lt; &quot;What would you like to divide &quot; &lt;&lt; x &lt;&lt; &quot; by?\n&quot;;
    float y;
    cin &gt;&gt; y;
    cout &lt;&lt; x &lt;&lt; &quot; divided by &quot; &lt;&lt; y &lt;&lt; &quot; is equal to &quot; &lt;&lt; x / y;
}

void power() {
    cout &lt;&lt; &quot;What integer would you like to start with?\n&quot;;
    long double x;
    cin &gt;&gt; x;
    cout &lt;&lt; x &lt;&lt; &quot; to the power of what?\n&quot;;
    long double y;
    cin &gt;&gt; y;
    cout &lt;&lt; x &lt;&lt; &quot; to the power of &quot; &lt;&lt; y &lt;&lt; &quot; is equal to &quot; &lt;&lt; pow(x, y);
}


int main()
{
    cout &lt;&lt; &quot;Would you like to add, subtract, multiply, divide, or use powers? (A,S,M,D,P)&quot;;
    string ans;
    cin &gt;&gt; ans;
    //user responds with the first letter of the operation they want
    if (ans == &quot;A&quot;) {
        add();
        return 0;
    }
    else if (ans == &quot;S&quot;) {
        subt();
        return 0;
    }
    else if (ans == &quot;M&quot;) {
        mult();
        return 0;
    }
    else if (ans == &quot;D&quot;) {
        divd();
        return 0;
    }
    else if (ans == &quot;P&quot;) {
        power();
        return 0;
    }
    else cout &lt;&lt; &quot;Error, try again with one of the above letters&quot;;
    return 1;
}
</code></pre>
",https://stackoverflow.com/questions/70269381/c-how-to-prevent-my-code-from-essentially-increasing-the-value-of-my-integer,"['c++', 'variables', 'calculator', 'calculation']",79,False,1,0
User simulation with jmeter for stress and scalability testing,"<p>Hi there I am trying to conduct stress and scalability testing for a web application. One of the problem is that it is not clear how many users the website can handle. So first I am conducting a stress testing with different user number. Consider below picture:</p>
<p><a href=""https://i.stack.imgur.com/XrD9S.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/XrD9S.png"" alt=""enter image description here"" /></a></p>
<p>In the picture first I am starting with 100 user by gradually increasing the load. So i have requirement for example:</p>
<ul>
<li>Response time should not be 7 sec</li>
<li>throughput should not fall under 35 request per second</li>
<li>Percentage of error should not be more than 10 percent of the total request</li>
</ul>
<p>So if this 100 user satisfies the requirement I will continue the test with 150 user and will go on until it breaks at least 2 requirement out of 3. And with that user I will perform the scalability test. Is this approach right? Please give me advise and how should I simulate user if not right?</p>
",https://stackoverflow.com/questions/68861331/user-simulation-with-jmeter-for-stress-and-scalability-testing,"['testing', 'jmeter', 'blazemeter']",146,True,-1,1
firestore query issues with 500 concurrent clients,"<p>I am doing some stress testing on my project and need your help in understanding the behavior. I have a web server which accepts json data from users and stores it in a firestore collection. Users can query this data. Document json only has two fields id1 and id2 and both are strings. Now as part of my stress test I start 500 threads to mimic 500 clients which query the collection to give each thread the documents where id1 == thread_id like this:</p>
<pre><code>query := client.Collection(&quot;mycollection&quot;).Where(&quot;id1&quot;, ==, my_id)    
iter := query.Documents(ctx)                          
snapList, err = iter.GetAll()
</code></pre>
<p>I see two issues:</p>
<ol>
<li>some of these queries are taking so long upto 20 seconds to return.</li>
<li>Some of the queries fail with connection error/io time out. I am using go sdk.</li>
</ol>
<blockquote>
<p>&quot;message&quot;:&quot;error: code = Unavailable desc = connection error: desc = &quot;transport: Error while dialing dial tcp x.x.x.x:443: i/o timeout&quot;&quot;}</p>
</blockquote>
<p>as per firestore documentation uptop 1 million concurrent clients are allowed. Then why am I getting issues on just 500? Even running this test on an empty collection I observe the same behavior. Is there any other rate limit that I am missing?
New</p>
",https://stackoverflow.com/questions/70452104/firestore-query-issues-with-500-concurrent-clients,"['go', 'google-cloud-firestore']",140,True,0,1
How to run threads in parallel,"<p>The stress test plan contains 5 threads, see below.</p>
<p>Lets consider a food booking app :</p>
<ul>
<li>Thread 0 contains the prerequisites such as extracting the token which will be used by the remaining threads (1,2,3,4).</li>
<li>Thread 1 relates to the food menu.</li>
<li>Thread 2 relates to adding items to the menu and calculating the order price.</li>
<li>Thread 3 creates the order.</li>
<li>Thread 4 confirms the order.</li>
</ul>
<p>Each thread requires the previous thread to be executed as it uses the response from the previous thread and I have been asked to run Thread 1,2,3,4 concurrently, but the fact is they cannot be run concurrently as
Thread 3 cannot be executed without actually executing Thread 2 and so on.
7.</p>
<p>Let me add a real-world use case:</p>
<ul>
<li>A user is viewing the menu items</li>
<li>Concurrently, another user is confirming the order</li>
<li>Another user is adding items to the cart</li>
</ul>
<p>Actually, all the operations are taking place concurrently, but no operation can be performed by skipping the previous threads.</p>
<p>How do I make changes to my script to accommodate such type of parallel stress testing?</p>
",https://stackoverflow.com/questions/69315282/how-to-run-threads-in-parallel,['jmeter'],105,False,-1,1
Most efficient way to generate XML payload in Java,"<p>In my application I have a REST endpoint (/processRequest) where I am receiving several parameters (clientId,channelId,opId). These parameters are then used to generate a XML payload with this structure:</p>
<pre><code>&lt;eCommerceDoc&gt;
   &lt;clientId&gt;5&lt;/clientId&gt;
   &lt;channelId&gt;2&lt;/channelId&gt;
   &lt;opId&gt;opIdString&lt;/opId&gt;
&lt;/eCommerceDoc&gt;
</code></pre>
<p>In the code it looks like this:</p>
<pre><code>@RestController public class RequestController {

@RequestMapping(value=&quot;/processRequest&quot;)
public String processRequest(
        @RequestParam(&quot;clientId&quot;)int clientId,
        @RequestParam(&quot;channelId&quot;)int channelId,
        @RequestParam(&quot;opId&quot;)String opId
        
        ) {

    String xml = 
            &quot;&lt;eCommerceDoc&gt;&quot; 
            +&quot;&lt;clientId&gt;&quot; + clientId + &quot;&lt;/clientId&gt;&quot; 
            +&quot;&lt;channelId&gt;&quot; + channelId + &quot;&lt;/channelId&gt;&quot; 
            +&quot;&lt;opId&gt;&quot; + opId + &quot;&lt;/opId&gt;&quot; 
            +&quot;&lt;/eCommerceDoc&gt;&quot;;

    sendXMLtoAnotherSystem(xml);
</code></pre>
<p>The problem with this is that the memory is getting filled really fast, I can see that for each request to this endpoint a new String is saved in memory:</p>
<p><a href=""https://i.stack.imgur.com/6VKzU.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/6VKzU.png"" alt=""enter image description here"" /></a></p>
<p>In this image we can see that last 2 Strings are the ones which are interned, and first 2 were generated because I triggered 2 requests for this example.</p>
<p>The problem is when doing stress testing, even without a big load these Strings are filling the heap too quickly, causing a lot of Minor Gcs, so my question is if there is a better approach to generate the XML dinamically (using SAX or some framework)? All the questions I have found are about Parsing but in this case I need to generate the actual XML because it is sent to another System. Thanks for the help.</p>
",https://stackoverflow.com/questions/65668891/most-efficient-way-to-generate-xml-payload-in-java,"['java', 'xml', 'performance']",110,True,0,1
Setting Openstack compute node with a fake hypervisor,"<p>I'm trying to set up openstack compute nodes that <em>mimics</em> a real node, however never actually sets up the VMs on a physical host.
In the openstack tests, there are usages of fake drivers (defined in <code>nova/virt/fake.py</code>) through a complex system of testing classes.</p>
<p>I wish to get such a node up and running <em><strong>not</strong></em>  within a test (meaning, I don't want to use these classes to spawn the compute node), but on an actual VM/container, however, I cannot figure out how to get a compute process to run with this fake hypervisor (or more specifically, one that will be defined by me).</p>
<p>How do I inject this fake driver instead of the real driver in a compute node?</p>
<p><em>(also, I'm installing OS using devstack (latest))</em></p>
<p>For more clarification, my goal is to do stress testing of OS, running multiple fake compute nodes, <strong>not</strong> in all-in-one configuration. The usage of devstack to setup the controller node is for simplifying the process, but the system should be:</p>
<ul>
<li>A controller node, running the core services (Nova, Glance, Keystone etc.).</li>
<li>Multiple compute nodes, using fake hypervisors on different machines.</li>
</ul>
",https://stackoverflow.com/questions/67677398/setting-openstack-compute-node-with-a-fake-hypervisor,"['openstack', 'openstack-nova']",282,True,3,1
Why does the response time curve of NodeJS API become sinus like under load?,"<p>I am currently performing an API Load Test on my NodeJS API using JMeter and am completely new to the field. The API is deployed on an IBM Virtual Server with 4 vCPUs and 8GB of RAM.
One of my load tests includes stress testing the API in a 2500 thread (users) configuration with a ramp-up period of 2700ms (45 min) on infinite loop. The goal is not to reach 2500 threads but rather to see at what point my API would throw its first error.
I am only testing one endpoint on my API, which performs a bubble sort to simulate a CPU intensive task. Using Matplotlib I plotted the results of the experiment. I plotted the response time in ms over the active threads. <a href=""https://i.stack.imgur.com/8O0e5.jpg"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/8O0e5.jpg"" alt=""enter image description here"" /></a></p>
<p>I am unsure why the response time curve becomes <strong>sinus like</strong> once crossing roughly 1100 Threads. I expected the response time curve keep rising in the same manner it does in the beginning (0 - 1100 threads). Is there an explanation for the <strong>sinus like</strong> behaviour of the curve towards the end?</p>
<p>Thank you!</p>
<p><strong>Graph:</strong></p>
<p>Red - Errors</p>
<p>Blue - Response time</p>
",https://stackoverflow.com/questions/68169598/why-does-the-response-time-curve-of-nodejs-api-become-sinus-like-under-load,"['node.js', 'api', 'jmeter', 'load-testing']",121,True,1,1
Benchmarking cache dictionary leads to &quot;Unexpected EOF while reading bytes&quot;,"<p>I have Clickhouse version 20.8.3.18 and python3 installed on a vm stress testing Cache dictionaries. After a certain number of entries the query using clickhouse_driver, I'll get the error</p>
<pre><code>Unexpected EOF while reading bytes
</code></pre>
<p>Is this an error due to the driver/python related or due to the cache being maxed on the system. For example this happens on a file size 203 columns and 10000 rows on a machine with 32Gb of RAM and 256Gb of SSD memory, a csv file of around 66Mb which seems quite small for such an error. The query I'm running is:</p>
<pre><code>SELECT  
    dictGet('CacheDictionary', 'date', toUInt64(number)) AS date, 
    SUM(dictGet('CacheDictionary', 'filterColumn', toUInt64(number))) AS val, 
    AVG(dictGet('CacheDictionary', 'filterColumn', toUInt64(number))) AS avg 
FROM numbers(1, 10000) 
GROUP BY date
</code></pre>
<p>An example entry of the csv file is:</p>
<pre><code>20000,2021-02-05,6867,0.5314826651111791,OA9SMRN54LC3MTDW,D6S8AYXZ3JVSHPCY,12UQV1JR87MT00EP,3WBT23MA2QN6URA7,YGKJR5577BP6S3AD,2T90WPW1REOZA0L9,JQG8Z6FXXIX2788M,OAOVV1YX3A6HKQV8,FISBMOAHEXHAAKEY,XAULW5F90T3VEMUL,RAAZ5TM5XL7GRC1F,B16JEGDHXUXFI2R9,DETSZ7BR45CRAIA7,Z2X53PAQYCSBHPU3,SRISC0ZLWXC2DP34,KO2M3044JX5JCB74,ML776REFIX3Z1L78,ND6PXBOR135SWFSB,ZF4K45N2AIGFAK0L,RFE3EHCKC5EPYE2V,NJKM5T8UUD5NRDPX,O57IQW0670LP00I9,F0EBZ3BXHPETCFSY,RUZ7VH2IM0DIZ4UC,08BP467WG7ROEHTJ,9LSTNLUA240T2K4D,5L4PIRKMK746QW5Q,2VX3SER8ULU93NZG,Z0MZ9C3TTPR6WFDV,KB32XWCR67AWGSIB,PDM8QJ34X4EOTVN1,P7TUVP8Q1YF9S746,YDFDBCG6S2EXYPNW,55RN0F4UMGF3ABQZ,RRF895J8LQSLI48U,54OQWCJODIEQLRQF,D5ZJPGAG7CCO4LWA,UQDWEXPI184UUJQD,3QF6QAS32ITRL8JH,FPQ324RO04LNVAMO,ZJ6QCWNQCBQOE7F5,6OWVEVWHNSZILC6E,GIUD29OIFF3LUCCX,VGBJHKW32BUNUSDH,908TDRODVZIIC5O8,UCIU38BXEREJMO4M,5LKJ23ER4CKUZ88J,A1GBKPPM10L8X5RM,BB3SAVWF3CNBDXHO,279MIC1OXTDS2PFP,J6UVFJE8RGFK4LDN,3CE12GT27GX0WVWU,PNNTRLDFVJQ0TCRK,MI7XOHWUQX3W938H,LKZPV4K0BA6OE3R0,YJMLI82UBLSZWP7U,JORNKD1MSVECXBRF,CO5KKJIL1FHEYA11,GXVXWDOI538WCLC0,OPODB2R2ITSX0E6J,3VE7SOJZL3DKIES7,5LPXB17GJ94S86HL,UQ0DZVUDMBD39LC3,KSSVOBUKMZC7T89M,P6YL0WW22NOM5A36,RA46SZF4ZLO5YWUM,TUTMJ34X4040USXX,09HPKJAD58P3FVMP,DM0NJVFYKR2653HH,HP869NM4Y2EBE3ND,RVKP40RPBOPB6RPQ,WI3QXYA5XIWJUFUK,770L6U5KAEPKKJC1,2H0XNUDM41QBAZWB,8AWJ2Y7RB9F2WTT0,Y6T3PIPLU3FCBZCU,CY8SCO15RNUWQU2B,DRC88XH21J9ADT6Z,MLZ2JN7F8MXVBHBI,2YSUVHRL4V0EVHXF,Y0U12EBQSEVE6W6X,A6RRJY191S0JOXJH,4F12P4K0SJ6EDKSD,THCRJ2ZEXGM1RUM4,PF0OUAULUNIW0W9X,EK1249WXC0C2KKY8,11WEDAAJL7BL4T4U,4K8OP1WXSN1MIXPF,8D0WNN1672A6WK07,5RLYH7K00ZSR1LL2,EKEXBG87U1X6UOLL,YWK3V1F7MTAF9T19,XZ8ZF0XO5V8TCBPS,A3RX8X8A8I11Z8X3,77P2Q5WRSTL4ERAI,00BGNPDYFSVG5F81,5KTUM76C42VTP4I7,TA933GZZN8OQ20QJ,612WNQ74RDHMBWX3,D41HNOBPX11GFYWO,OGR4A0EPCSS00XL6,QIOH165Y5JGKJMFC,TF2R9TFC5TJN2PER,TYNXWI46H7I83O77,JMD5DOEV4U628SDK,D7ECJH43FEC77UCJ,FKA9AT5J20QI3MQP,7QSU0I8VRRLUMD7R,6OJ1O2XI2QJXP6W2,UD2QVJXNUFRCAO43,GS3TZUW8U6Z8EWWQ,QD79GBSO6D6GCAZ1,GQ5TUY2FMJSNMTRK,OGOYL2PD64E2DOOQ,Q733OU5P7J7SAFS1,GBS7MV5QOMQ4E89N,SB8MIQ1P37HMQZBJ,Z6G96BM7FL4150H3,05PS81HW528971RM,6F3KFLYT0345GI43,G65CDWEORNH3OUCY,12F43L99AZ84PDWR,GQQVWMTMS471WAWD,F1DFWRJ1F9M9MUTT,1M734H07IQAW49Q3,OPSRG5J7370227XE,BIPNR22KFF71MKQN,PV7DWGCQF5551FKT,YPGQVGUP37MRJY2B,RILKP96QV69WBW2D,4RXDCJURAVCQEGLX,XGIPC0AK1K0I6KDP,HMSE306L5NAK62LC,YAZHMS2UHGMWIB44,RZCAVUM45YTNV23T,3B7K07XPRTE8OMW1,FTP48ED5DQ4K3DM8,WW419RRJ2WU1F15L,85FWD49J0ARSUGI9,4U4768ANPCJ46K5P,EJ24BNUA6OZMUDEL,6Z27W6BN36GO8QWU,5AMZ4UU819GSI454,KMNIEJ2V5PI83KGP,APT4CYG8M5FM0BSW,IME5VRP08W468DZE,6BT4W0ZAW6C7993L,DRD6Q4P8BZVDG37U,2R1OEWQFV5J597AF,CKS41A6PXKVYICAG,OQYZ9UOQRVS3LLTF,JA3PZSAXFCJVZVLB,J23BP73T6GNC0Z08,GWOJXMXDVHCRE51Y,I826DE6KEVQK2PFC,6FF5LWM61KCM4C9K,P16P80EIX2X87OZO,O5GEOEO72CDV4GAX,UMKFUKMV6U0L5PM5,U64YI4G53LR3SC6J,CLML8KPAL697KYYJ,LMH2W0STEJ5H2J2S,AL61EP61ZR3GOPN3,Z3AEUMZSX4MQJ6M6,IS5RFEWIJ8XHYNK0,TNE1BS4JYN280PIF,67IER2YS6N2XHEW1,63P3O4X42T2INRT4,XYV043108XRK7Y4S,RW0HN600K0GQXF4Y,BZ1ZE6IBB4B72A81,QHAINYDIZX7838YI,7FFCKG3XJSZ2DIHJ,DF6C1OMPC1ETFPDZ,1EJ3EW0TXKVBC88R,WX6HG8FD021VFZ2S,W4OB9NZRODSTM96M,6GDA3L5CLBPVTPWQ,1Y4U7BL9UHPBJVIX,Y31SUUZ0JF2AXZWO,PL2I18PA0SVXG85E,TEY1HC97QMZ5YXMI,T49EVLLM43AI4OG3,0SDNMLWY85Z7NENX,4446QKGO8UL6RERT,IMEAM22I51GT4ZHY,HUCLC93NIUG0C5R0,5VPBRUUVMBXP7HJY,XCOOPM3JU5VHQ94T,3LRZGAF451G9XDIN,Y6VIN1E31NYRLA2N,RAROO2EM5Q9NJRG9,NUQ2QJ9M6T5KRCHK,WQKKQK8UBB30GRWI,20SOMMKD08FYAENW,1G9K4UFWAI8Q7Z8K,XLG898A4MQXZHVYR,FPT67A7VDLVZEWYH,6DQ6417FF07FORXZ,10RUAPY5KGAYBZZD
</code></pre>
<p>I've posted part of the code trying to find the maximum number of cache items stored, along with the queries executed for each. In <code>selectBenchmark</code> the <code>string</code> correspond to the query above. The parameters for each are fairly self explanatory (the xmlFile is the dictionary created in <code>/etc/lib/clickhouse-server</code>).</p>
<pre><code>def cacheMaxItems(csvRead, xmlFile, benchmarkType, columnStepSize, rowStepSize):
    maxCache = []
    os.system('rm -f ' + csvRead)
    os.system('bash /root/restartCH.sh')
    for j in range(1, 13):
        outputCSV = '/root/results' + benchmarkType + '/cacheResults' + str(j*columnStepSize) + '.csv'  
        with open(outputCSV, 'w') as fp:
            wr = csv.writer(fp)  
            wr.writerow([benchmarkType + ': Number of rows', 'Loading time', 'Mean', 'Variance', 'Skewness', 'Number of Columns: ' + str(j*columnStepSize)])
        for i in range(1, 10000):
            if i%5 == 0:
                os.system('bash /root/restartCH.sh')
            createCSV(10000, j*columnStepSize, csvRead)
            try:
                clickhouseDictionary(rowStepSize*i*j*columnStepSize, j*columnStepSize, xmlFile, csvRead, 'Cache')
                if benchmarkType == 'Random':
                    results = selectBenchmark(i*rowStepSize, j*columnStepSize, 'Random', 'Cache')
                elif benchmarkType == 'Consecutive':
                    results = selectBenchmark(i*rowStepSize, j*columnStepSize, 'Consecutive', 'Cache')
                elif benchmarkType == 'CPU':
                    results = selectBenchmark(i*rowStepSize, j*columnStepSize, 'CPU', 'Cache')
                results.insert(0, i*rowStepSize)
                with open(outputCSV, 'a') as fp:
                    wr = csv.writer(fp)  
                    wr.writerow(results)

                print('Successfully loaded and queried cache of size ' + str(rowStepSize*i*j*columnStepSize) + '.')
            except Exception as ex:
                print(ex)
                os.system('rm -f ' + csvRead)
                os.system('bash /root/restartCH.sh')
                maxCache.append([j*columnStepSize, (i-1)*rowStepSize])
                print(maxCache)
                break
    return maxCache
</code></pre>
<pre><code>def selectBenchmark(numberOfRows, numberOfColumns, benchmarkType, dictType):
    client = Client('localhost', port=9000, database='system')
    client.execute('SYSTEM RELOAD DICTIONARY ' + dictType + 'Dictionary')
    loadingTime = client.last_query.elapsed
    client.execute('SELECT dictGet(\'' + dictType + 'Dictionary\', \'random0\', toUInt64(1))', query_id=str(uuid.uuid4()))
    loadingTime += client.last_query.elapsed
    loop = True
    counter = 0
    j=0
    while loop:
        times = []
        for i in range(0, 31):
            query_id = str(uuid.uuid4())
            string = stringGen(numberOfRows, numberOfColumns, benchmarkType, dictType)
            client.execute(string, query_id = query_id)
            times.append(client.last_query.elapsed)  
        if max(times) &gt; loadingTime:
            loadingTime = max(times)
        stats = transformedMLE(times)
        redactedTimes = [x for x in times if (stats[0]-3*np.sqrt(stats[1])) &lt; x &lt; (stats[0]+3*np.sqrt(stats[1]))]
        if len(times) - len(redactedTimes) &lt;= 3:
            loop = False
        elif j &gt; 15:
            print('High variance query')
            loop = False
        j+=1
    result = transformedMLE(redactedTimes)
    loadingTime = loadingTime - result[0]
    result.insert(0, loadingTime)
    client.disconnect()
    return result
</code></pre>
<p>The restartCH.sh file is</p>
<pre><code>service clickhouse-server forcerestart
</code></pre>
<p>as the cache overflow often blocks the <code>restart</code> command.
There is no output to the server error logs indicating that this is a problem with the python driver, perhaps reading the large amounts of data being returned. I also get the 'Killed' python output which also points towards cache issues, which is to be expected as I'm benchmarking cache dictionaries.</p>
",https://stackoverflow.com/questions/66037213/benchmarking-cache-dictionary-leads-to-unexpected-eof-while-reading-bytes,"['python', 'database', 'out-of-memory', 'clickhouse']",1918,True,0,2
Stress-testing with artillery - Getting an auth0 bearer token using login flow,"<p>I want to use <a href=""https://artillery.io"" rel=""nofollow noreferrer"">artillery.io</a> as a stress-testing tool, and want to setup a basic stress-test. But all my url's are behind an auth wall (using Auth0) and I want to try to get a valid token for the testing session so that my backend does not throw me into a 401-spiral. The artillery docs explains that I can hook up to some lifecycle events using <code>processor</code>, but does not explain which lifecycle hooks I have available. I've managed to figure out that there is a <code>beforeRequest</code> hook I can use, but this does not seem optimal as this will probably run before every request. My tokens have at least an hour validity...</p>
<p><strong>So the main question is;</strong> how do I construct a processor hook which taps into the auth0 login flow, retreives a token which can then be stored in an environment variable (or some other local mechanism) for use as an Authorization Bearer token in future requests done by artillery?</p>
<p>OR if this is a bad pattern to follow, what is the best practice for urls behind auth-walls? I've already thought about loging in first and then copying the token to an environment variable and use that, but this makes the test a bit harder to use since it requires a manual step.</p>
<p>Any input is greatly appreciated.</p>
",https://stackoverflow.com/questions/67073439/stress-testing-with-artillery-getting-an-auth0-bearer-token-using-login-flow,"['auth0', 'artillery']",266,False,1,0
Where&#39;s the bottleneck when I wait for a Kafka message then return a value in Actix Web?,"<p>I am trying to communicate between 2 microservices written in Rust and Node.js using Kafka.</p>
<p>I'm using actix-web as web framework and rdkafka as Kafka client for Rust. On the Node.js side, it queries stuff from the database and returns it as JSON to the Rust server via Kafka.</p>
<p>The flow:</p>
<pre class=""lang-none prettyprint-override""><code>Request -&gt; Actix Web -&gt; Kafka -&gt; Node -&gt; Kafka -&gt; Actix Web -&gt; Response
</code></pre>
<p>The logic is the request hits an endpoint on Actix Web, then creates a message to request something to another micro-service and waits until it sends back (verify by Kafka message key), and returns it to the user as an HTTP response.</p>
<hr />
<p>I got it to work, but the performance is very slow (I am stress-testing with <code>wrk</code>).</p>
<p>I'm not sure why it's performing slow but as I was digging down, I found that if I add a delay on the Node.js side for 5 seconds and I create 2 requests to actix-web where the requests are different by a second, it will respond with a 5 and 10-second delay.</p>
<p>The benchmark is around 3k requests per second, using the following command:</p>
<pre class=""lang-sh prettyprint-override""><code>wrk http://localhost:8080 -d 20s -t 2 -c 200
</code></pre>
<p>This makes me guess that something might be blocking the thread for each request.</p>
<p>Here is the <a href=""https://github.com/SaltyAom/experimental-kafka-queue/blob/a06ceafe4c3e662ae2d5391439dd91838f6ce9f5/main/src/main.rs"" rel=""nofollow noreferrer"">source code</a> and the <a href=""https://github.com/SaltyAom/experimental-kafka-queue"" rel=""nofollow noreferrer"">repo</a>:</p>
<pre class=""lang-rust prettyprint-override""><code>use std::{
    sync::Arc,
    time::{ 
        Duration, 
        Instant
    }
};

use actix_web::{
    App, 
    HttpServer, 
    get, 
    rt,
    web::Data
};

use futures::TryStreamExt;
use tokio::time::sleep;

use num_cpus;
use rand::{
    distributions::Alphanumeric, 
    Rng
};

use rdkafka::{
    ClientConfig, 
    Message, 
    consumer::{
        Consumer, 
        StreamConsumer
    }, 
    producer::{
        FutureProducer, 
        FutureRecord
    }
};

const TOPIC: &amp;'static str = &quot;exp-queue_general-5&quot;;

#[derive(Clone)]
pub struct AppState {
    pub producer: Arc&lt;FutureProducer&gt;,
    pub receiver: flume::Receiver&lt;String&gt;
}

fn generate_key() -&gt; String {
    rand::thread_rng()
        .sample_iter(&amp;Alphanumeric)
        .take(8)
        .map(char::from)
        .collect()
}

#[get(&quot;/&quot;)]
async fn landing(state: Data&lt;AppState&gt;) -&gt; String {
    let key = generate_key();
    let t1 = Instant::now();

    let producer = &amp;state.producer;
    let receiver = &amp;state.receiver;

    producer
        .send(
            FutureRecord::to(&amp;format!(&quot;{}-forth&quot;, TOPIC))
                .key(&amp;key)
                .payload(&quot;Hello From Rust&quot;),
                Duration::from_secs(8)
        )
        .await
        .expect(&quot;Unable to send message&quot;);

    println!(&quot;Producer take {} ms&quot;, t1.elapsed().as_millis());
    
    let t2 = Instant::now();
    let value = receiver
        .recv()
        .unwrap_or(&quot;&quot;.to_owned());

    println!(&quot;Receiver take {} ms&quot;, t2.elapsed().as_millis());
    println!(&quot;Process take {} ms\n&quot;, t1.elapsed().as_millis());

    value
}

#[get(&quot;/status&quot;)]
async fn heartbeat() -&gt; &amp;'static str {
    // ? Concurrency delay check
    sleep(Duration::from_secs(1)).await;

    &quot;Working&quot;
}

#[actix_web::main]
async fn main() -&gt; std::io::Result&lt;()&gt; {
    // ? Assume that the whole node is just Rust instance
    let mut cpus = num_cpus::get() / 2 - 1;

    if cpus &lt; 1 {
        cpus = 1;
    }

    println!(&quot;Cpus {}&quot;, cpus);
    
    let producer: FutureProducer = ClientConfig::new()
        .set(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;)
        .set(&quot;linger.ms&quot;, &quot;25&quot;)
        .set(&quot;queue.buffering.max.messages&quot;, &quot;1000000&quot;)
        .set(&quot;queue.buffering.max.ms&quot;, &quot;25&quot;)
        .set(&quot;compression.type&quot;, &quot;lz4&quot;)
        .set(&quot;retries&quot;, &quot;40000&quot;)
        .set(&quot;retries&quot;, &quot;0&quot;)
        .set(&quot;message.timeout.ms&quot;, &quot;8000&quot;)
        .create()
        .expect(&quot;Kafka config&quot;);

    let (tx, rx) = flume::unbounded::&lt;String&gt;();

    rt::spawn(async move {
        let consumer: StreamConsumer = ClientConfig::new()
            .set(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;)
            .set(&quot;group.id&quot;, &amp;format!(&quot;{}-back&quot;, TOPIC))
            .set(&quot;queued.min.messages&quot;, &quot;200000&quot;)
            .set(&quot;fetch.error.backoff.ms&quot;, &quot;250&quot;)
            .set(&quot;socket.blocking.max.ms&quot;, &quot;500&quot;)
            .create()
            .expect(&quot;Kafka config&quot;);

        consumer
            .subscribe(&amp;vec![format!(&quot;{}-back&quot;, TOPIC).as_ref()])
            .expect(&quot;Can't subscribe&quot;);

        consumer
            .stream()
            .try_for_each_concurrent(
                cpus,
                |message| {
                    let txx = tx.clone();

                    async move {
                        let result = String::from_utf8_lossy(
                            message
                            .payload()
                            .unwrap_or(&quot;Error serializing&quot;.as_bytes())
                        ).to_string();

                        txx.send(result).expect(&quot;Tx not sending&quot;);

                        Ok(())
                    }

                }
            )
            .await
            .expect(&quot;Error reading stream&quot;);
    });

    let state = AppState {
        producer: Arc::new(producer),
        receiver: rx
    };

    HttpServer::new(move || {
        App::new()
            .app_data(Data::new(state.clone()))
            .service(landing)
            .service(heartbeat)
    })
    .workers(cpus)
    .bind(&quot;0.0.0.0:8080&quot;)?
    .run()
    .await
}
</code></pre>
<p>I found some solved issues on GitHub which recommended using actors instead which I also did as <a href=""https://github.com/SaltyAom/experimental-kafka-queue/tree/feat/actor"" rel=""nofollow noreferrer"">a separate branch</a>.</p>
<p>This has worse performance than the main branch, performing around 200-300 requests per second.</p>
<hr />
<p>I don't know where the bottleneck is or what's the thing that blocking the request.</p>
",https://stackoverflow.com/questions/68199081/wheres-the-bottleneck-when-i-wait-for-a-kafka-message-then-return-a-value-in-ac,"['apache-kafka', 'rust', 'actix-web', 'librdkafka']",431,False,0,0
Need guidance to Increase request traffic on our project,"<p>We are facing an issue with the database on our project.</p>
<p>We want to support at least 20 requests per second but if we go to this number (with stress-testing setup) our database or something else on our setup can not cope with this load even if the actual request’s code is disabled (this means that the API only checks if the user is a valid one and don’t make the whole job that supposed to do). The users’ table at this time is under 100 rows with 10 columns.</p>
<p>The stack is built with docker. We use <code>MySQL 8.0.14</code>. The project is written on <code>yii2</code> and we use the <code>ActiveRecord</code> to access the database on every query.</p>
<p>A request’s workflow is as follows. When a user makes an API request sends a JWT token along with it. Then the API asks a MongoDB for this token to verify that it is ours. If this is the case then with the userId from mongo we ask this user’s data from our MySQL where all the needed info for this user is stored. After that, we execute the request’s code.</p>
<p>The stress-test query that concerns us is when we simulate 500 users that make 1 request every 10 seconds and run for 3 minutes. In this test, we disable the request’s code and we only let the code where we check about the user's validity. Below are the results:</p>
<p>the program we use to simulate traffic <a href=""https://github.com/rakyll/hey"" rel=""nofollow noreferrer"">here</a></p>
<p>Running: <code>./hey -c 500 -q 0.1 -z 3m</code></p>
<pre><code>  Summary:
  Total:        191.2756 secs
  Slowest:      19.9512 secs
  Fastest:      0.2022 secs
  Average:      9.1227 secs
  Requests/sec: 40.1306

Response time histogram:
  0.202 [1]     |
  2.177 [639]   |■■■■■■■■■■■■■
  4.152 [320]   |■■■■■■
  6.127 [750]   |■■■■■■■■■■■■■■■
  8.102 [1355]  |■■■■■■■■■■■■■■■■■■■■■■■■■■■
  10.077 [881]  |■■■■■■■■■■■■■■■■■■
  12.052 [671]  |■■■■■■■■■■■■■
  14.026 [2012] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  16.001 [527]  |■■■■■■■■■■
  17.976 [25]   |
  19.951 [12]   |

Status code distribution:
  [200] 6550 responses
  [500] 34 responses
  [502] 609 responses
</code></pre>
<p>more tests can be found <a href=""https://docs.google.com/document/d/1Mg2SZHyqbsamrJ2cSspQr0OOhXmia8IVVMD2Nuy6jwY/edit?usp=sharing"" rel=""nofollow noreferrer"">here</a></p>
<p>the tables the request access when it only validates the user</p>
<pre><code>
CREATE TABLE `user_profile` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `company_id` int(10) unsigned NOT NULL,
 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
 `system_status` tinyint(3) unsigned NOT NULL,
 `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
 `telephone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
 `last_login_datetime` datetime DEFAULT NULL,
 `creation_datetime` datetime NOT NULL,
 `modification_datetime` datetime NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `user_profile@email_uniqueIdx` (`email`),
 UNIQUE KEY `user_profile@telephone_uniqueIdx` (`telephone`),
 KEY `user_profile@company_id_idx` (`company_id`),
 CONSTRAINT `fk_user_profile_w_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_c



CREATE TABLE `user_profile_role` (
 `user_profile_id` int(10) unsigned NOT NULL,
 `role` tinyint(3) unsigned NOT NULL,
 `creation_datetime` datetime NOT NULL,
 `modification_datetime` datetime NOT NULL,
 PRIMARY KEY (`user_profile_id`,`role`),
 CONSTRAINT `fk_user_profile_role_w_user_profile` FOREIGN KEY (`user_profile_id`) REFERENCES `user_profile` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci




CREATE TABLE `company` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
 `system_status` tinyint(3) unsigned NOT NULL,
 `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
 `telephone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
 `website` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
 `creation_datetime` datetime NOT NULL,
 `modification_datetime` datetime NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `company@name_uniqueIdx` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci



mongo db


* This is the model class for table &quot;UserProfileJsonWebToken&quot;.
*
* @property ObjectId $_id
* @property int $userProfileId
* @property string $value
* @property int $acquireCount
* @property int $systemStatus
* @property string $lastUseDatetime
* @property string $creationDatetime
* @property string $modificationDatetime
*/

</code></pre>
<p>when DB is not under load the request with the code enabled needs 361ms</p>
<p>Yii debug log for Post requests
<a href=""https://docs.google.com/document/d/1Ri-JLIFp2K1ATAVFBC1OEzdr1kQq6z9pLBlZVJHSQKA/edit?usp=sharing"" rel=""nofollow noreferrer"">here</a></p>
<hr />
<p><strong>1. update</strong>
after disable debug mode and added cache</p>
<hr />
<p>main-db.php</p>
<pre><code>        'enableSchemaCache' =&gt; true,
        'schemaCacheDuration' =&gt; 86400,
        'schemaCache' =&gt; 'cache',
</code></pre>
<p>main.php</p>
<pre><code>    'components' =&gt; [
        'cache' =&gt; [

            'class' =&gt; 'yii\caching\FileCache',

        ],
</code></pre>
<p>i'am getting this results</p>
<pre><code>Summary:
  Total:        187.0877 secs
  Slowest:      7.3969 secs
  Fastest:      0.1197 secs
  Average:      3.5332 secs
  Requests/sec: 48.1058

  Total data:   1239578 bytes
  Size/request: 143 bytes

Response time histogram:
  0.120 [1]     |
  0.847 [187]   |■■■■■
  1.575 [1633]  |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  2.303 [1078]  |■■■■■■■■■■■■■■■■■■■■■■■■■■
  3.031 [1102]  |■■■■■■■■■■■■■■■■■■■■■■■■■■■
  3.758 [811]   |■■■■■■■■■■■■■■■■■■■■
  4.486 [628]   |■■■■■■■■■■■■■■■
  5.214 [1172]  |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  5.941 [905]   |■■■■■■■■■■■■■■■■■■■■■■
  6.669 [687]   |■■■■■■■■■■■■■■■■■
  7.397 [455]   |■■■■■■■■■■■


Latency distribution:
  10% in 1.1331 secs
  25% in 1.8714 secs
  50% in 3.3492 secs
  75% in 5.1533 secs
  90% in 6.2478 secs
  95% in 6.7027 secs
  99% in 7.2395 secs

Details (average, fastest, slowest):
  DNS+dialup:   0.0100 secs, 0.1197 secs, 7.3969 secs
  DNS-lookup:   0.0000 secs, 0.0000 secs, 0.0000 secs
  req write:    0.0001 secs, 0.0000 secs, 0.0115 secs
  resp wait:    3.5052 secs, 0.1163 secs, 7.3231 secs
  resp read:    0.0001 secs, 0.0000 secs, 0.0024 secs

Status code distribution:
  [200] 7446 responses
  [502] 1213 responses

Error distribution:
  [341]Post &quot;http://127.0.0.1/api/v1/vehicle-locations&quot;: EOF

</code></pre>
<p>I am having a big improvement but more work is needed</p>
",https://stackoverflow.com/questions/65657067/need-guidance-to-increase-request-traffic-on-our-project,"['mysql', 'mongodb', 'performance', 'yii2', 'http-post']",316,False,1,0
Cannot start listening to ManagementEventWatcher,"<p>I have implemented a solution as per <a href=""https://gist.github.com/M0n7y5/b45669c238ff3f2602c1859b3829137c"" rel=""nofollow noreferrer"">this here example</a> where I listen to serial port changes. Normally this worked good but recently I have started stress testing the application and noticed that in certain situations this does not work.</p>
<p><strong>Situation 1:</strong></p>
<p>I have no serial ports. Nothing is connected. The code fails at the <code>deviceAttachWatcher.Start();</code>. So this is the first point where the code should start listening for changes. The error message is <em>NotSupported</em>. If I look in EventViewer under Applications and Services Logs/Microsoft/Windows/WMI-Activity/Operation I can find an entry with following message:</p>
<blockquote>
<p>Id = {00000000-0000-0000-0000-000000000000}; ClientMachine = xyz; User
= DOMAIN\user.name; ClientProcessId = 16548; Component = Unknown; Operation = Start IWbemServices::ExecNotificationQuery - root\WMI :
select * from __InstanceCreationEvent within 1 where TargetInstance
ISA 'MSSerial_PortName'; ResultCode = 0x80041032; PossibleCause =
Unknown</p>
</blockquote>
<p><strong>Situation 2:</strong></p>
<p>I have one serial port. The code does not fail at <code>deviceAttachWatcher.Start();</code>. It even goes through the second call <code>deviceDetachWatcher.Start();</code>. The application is not listening to changes on serial ports but if I connect or disconnect this device nothing happens. I get two entries in the Event Viewer.</p>
<ul>
<li>Entry 1</li>
</ul>
<blockquote>
<p>Namespace = root\WMI; NotificationQuery = select * from
__InstanceCreationEvent within 1 where TargetInstance ISA 'MSSerial_PortName'; UserName = DOMAIN\user.name;
ClientProcessID = 20260, ClientMachine = xyz; PossibleCause =
Temporary</p>
</blockquote>
<ul>
<li>Entry 2</li>
</ul>
<blockquote>
<p>Namespace = root\WMI; NotificationQuery = select * from
__InstanceDeletionEvent within 1 where TargetInstance ISA 'MSSerial_PortName'; UserName = DOMAIN\user.name;
ClientProcessID = 20260, ClientMachine = xyz; PossibleCause =
Temporary</p>
</blockquote>
<p>These two event entries correspond to my two queries.</p>
<p><strong>Situation 3:</strong></p>
<p>I have 2 serial ports connected. Code works as expected.</p>
<p><strong>QUESTION</strong></p>
<p>Obviously, I would like the situation 3 to be the constant. What is happening in situations 1 and 2? Why am I getting &quot;NotSupported&quot; error?</p>
<p>Initially I had <a href=""https://stackoverflow.com/questions/64669672/the-application-specific-permission-settings-do-not-grant-local-activation-permi"">this</a> problem as well but I fixed it as per answer so now I do not get this log entry in the Event Viewer anymore(this one was under Windows Logs/System).</p>
<p><strong>UPDATE</strong></p>
<p>I just tested this on my colleagues machine and he has the same issue so environment as a problem is out.</p>
",https://stackoverflow.com/questions/69807338/cannot-start-listening-to-managementeventwatcher,"['c#', 'wmi']",134,False,0,0
Memory increases with each request when using AutoMapper&#39;s ProjectTo with expand option,"<p>I'm building a .NET 5 REST API based on CQRS/MediatR and I noticed a linear memory increase when stress testing my application. I did some profiling and saw a large number of object instances from the namespace <code>System.Linq.Expression</code> was taking up all the space. All these instances are related to the <code>MapperConfiguration</code> of AM.</p>
<p>I use AutoMapper to map my entities to the DTOs, to do so I mainly use the following <code>ProjectTo</code> extension method :</p>
<pre><code>public static IQueryable&lt;TDestination&gt; ProjectTo&lt;TDestination&gt;(this IQueryable source, IConfigurationProvider configuration, object parameters, params Expression&lt;Func&lt;TDestination, object&gt;&gt;[] membersToExpand);
</code></pre>
<p>After some testing, I noticed that the memory problem is only happening when providing <code>membersToExpand</code> inside the <code>ProjectTo</code> method.</p>
<p>When providing an &quot;expand&quot; and calling the related endpoint, it's like the expression of the mapping is created each time but never freed. As they stay, they accumulates in memory and add as the query is called.</p>
<p>Here is a screenshot of the memory state comparing two snapshots :</p>
<ul>
<li>The first one after one call to the endpoint</li>
<li>The second one after five more call to the same endpoint (without changing anything)</li>
</ul>
<p><a href=""https://i.stack.imgur.com/HdUbA.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/HdUbA.png"" alt=""Memory comparison between first and sixth call"" /></a></p>
<p>I wouldn't mind the memory usage thinking it may be some kind of cache used by AM to have better response time but the problem is that the more memory is used the slower it gets for my API to respond to the request (4ms at the start to 90ms after the stress test). I guess AM has a hard time searching inside so many stored expressions. As soon as I stop using the &quot;expand&quot; system, the responses are again instantaneous (4ms).</p>
<p>Last point is that when the application pool is recycled (and the memory cleared), the API responds again in full speed at 4ms (with the expand).</p>
<p>I searched online for hours to see if I had missed a specific AM configuration related to caches or something, but found nothing.</p>
<p><strong>Does anyone has an idea, similar experience or more information about this behaviour ?</strong></p>
<p>PS : As you can see, I use AM with DI (using the package for DI and <code>.AddAutoMapper</code> method)</p>
<p>Below, some code samples from my application :</p>
<p><code>RoleByProfileDto</code> (<code>RoleDto</code> has nothing particular and <code>ReverseMap</code> is only here for &quot;translation&quot; purpose) :</p>
<pre class=""lang-cs prettyprint-override""><code>    public class RoleByProfileDto : RoleDto
    {
        public ProfileRoleDto ProfileRole { get; set; }

        public void Mapping(AM.Profile profile)
        {
            int profileId = default;

            profile.CreateMap&lt;Role, RoleByProfileDto&gt;()
                .ForMember(dto =&gt;
                    dto.ProfileRole, opts =&gt;
                        opts.MapFrom(r =&gt; r.ProfileRoles.FirstOrDefault(pr =&gt; pr.ProfileId == profileId))
                )
                .IncludeBase&lt;Role, RoleDto&gt;()
                .ReverseMap();
        }
    }
</code></pre>
<p>Handler of the said request :</p>
<pre class=""lang-cs prettyprint-override""><code>    public class GetRoleByProfileAndIdQueryHandler : IRequestHandler&lt;GetRoleByProfileAndIdQuery, RoleByProfileDto&gt;
    {
        private readonly IApplicationDbContext _context;
        private readonly AM.IMapper _mapper;

        public GetRoleByProfileAndIdQueryHandler(IApplicationDbContext context, AM.IMapper mapper)
        {
            _context = context;
            _mapper = mapper;
        }

        public async Task&lt;RoleByProfileDto&gt; Handle(GetRoleByProfileAndIdQuery request, CancellationToken cancellationToken)
        {
            var dto = await _context.Roles
                .Where(r =&gt;
                    r.Id == request.RoleId
                    &amp;&amp; r.ProfileRoles.Any(pr =&gt;
                        pr.ProfileId == request.ProfileId
                    )
                )
                .ProjectTo(
                    _mapper.ConfigurationProvider,
                    new { profileId = request.ProfileId },
                    request.Expand.GetExpandMemberList(ExpandMappings)
                )
                .FirstOrDefaultAsync(cancellationToken);

            if (dto == null)
            {
                throw new NotFoundException(
                    nameof(Role),
                    new List&lt;string&gt;() { nameof(Profile), nameof(Role) },
                    new List&lt;object&gt;() { request.ProfileId, request.RoleId }
                );
            }

            return dto;
        }

        private static readonly IReadOnlyDictionary&lt;RoleByProfileAndIdExpand, Expression&lt;Func&lt;RoleByProfileDto, object&gt;&gt;&gt; ExpandMappings =
            new Dictionary&lt;RoleByProfileAndIdExpand, Expression&lt;Func&lt;RoleByProfileDto, object&gt;&gt;&gt;
            {
                { RoleByProfileAndIdExpand.ProfileRole, d =&gt; d.ProfileRole }
            };
    }
</code></pre>
<p>The method used to build the expand array that is provided to the <code>ProjectTo</code> :</p>
<pre class=""lang-cs prettyprint-override""><code>        public static Expression&lt;Func&lt;TDto, object&gt;&gt;[] GetExpandMemberList&lt;TEnum, TDto&gt;(
            this IList&lt;TEnum&gt; selectedExpands,
            IReadOnlyDictionary&lt;TEnum, Expression&lt;Func&lt;TDto, object&gt;&gt;&gt; mappings
        )
            where TEnum : Enum
            where TDto : BaseDto
        {
            if (selectedExpands != null &amp;&amp; selectedExpands.Any())
                return selectedExpands.Select(e =&gt; mappings[e]).ToArray();
            else
                return Array.Empty&lt;Expression&lt;Func&lt;TDto, object&gt;&gt;&gt;();
        }
</code></pre>
",https://stackoverflow.com/questions/70425763/memory-increases-with-each-request-when-using-automappers-projectto-with-expand,"['c#', 'automapper', '.net-5']",1701,True,2,1
Time comlexity is sqrt(n) but how did we obtained it?,"<p>In first steps in algorithmic design and analysis I am following the book Algorithm Design by Kleinberg and Tardos I came across the Question/Case you can find down the page
the solution is indeed f(n) = sqrt(n). My concerns are :</p>
<p>1- Why I still find log(n) more acceptable .I still could not grasp the plus value from sqrt(n) even when it is said that we will use more jars / trials .</p>
<p>2- from where did we get the sqrt(n) ?. Using k jars (trials) I could think of n/k incrementation but then  lim n→∞ f(n) /n toward infinity is 1/k which is not 0. I got the feeling that the '2' in n^1/2 is tightly related to k = 2 , if yes how.</p>
<p>Thank you.</p>
<blockquote>
<p>Case: Assume that a factory is doing some stress-testing on various
models of glass jars to determine the height from which they can be
dropped and still not break. The setup for this experiment, on a
particular type of jar, is as follows. You have a ladder with n rungs,
and you want to find the highest rung from which you can drop a copy
of the jar and not have it break. We call this the highest safe rung.
It might be natural to try binary search: drop a jar from the middle
rung, see if it breaks, and then recursively try from rung n/4 or 3n/4
depending on the outcome. But this has the drawback that you could
break a lot of jars in finding the answer. If your primary goal were
to conserve jars, on the other hand, you could try the following
strategy. Start by dropping a jar from the first rung, then the second
rung, and so forth, climbing one higher each time until the jar
breaks. In this way, you only need a single jar—at the moment it
breaks, you have the correct answer—but you may have to drop it n
times. So here is
the trade-off: it seems you can perform fewer drops if you’re willing
to break more jars. To understand better how this trade- off works at
a quantitative level, let’s consider how to run this experiment given
a fixed “budget” of k ≥ 1 jars. In other words, you have to determine
the correct answer—the highest safe rung—and can use at most k jars in
doing so. Now, please solve these two questions:</p>
<ol>
<li>Suppose you are given a budget of k = 2 jars. Describe a strategy for finding the highest safe rung that requires you to drop a jar at
most f(n) times, for some function f(n) that grows slower than
linearly. (In other words, it should be the case that lim n→∞ f(n)/n =
0.)</li>
</ol>
</blockquote>
",https://stackoverflow.com/questions/67497149/time-comlexity-is-sqrtn-but-how-did-we-obtained-it,"['algorithm', 'time-complexity', 'big-o']",677,True,2,1
Can newline-delimited fwrite()s be truncated partway through a line upon SIGINT/SIGKILL in PHP?,"<p>Using plain <code>fopen(..., 'w')</code> and <code>fwrite()</code> in PHP, I'm writing simple <code>\n</code>-delimited lines of text to a file.</p>
<p><code>strace</code> tells me that PHP is using <code>write()</code> to write the data to disk.</p>
<p>From <a href=""https://man7.org/linux/man-pages/man2/write.2.html"" rel=""nofollow noreferrer"">write(2)</a> (Linux):</p>
<blockquote>
<p>The number of bytes written may be less than count if, for example, there is insufficient space on the underlying physical medium, or the RLIMIT_FSIZE resource limit is encountered (see setrlimit(2)), or <strong>the call was interrupted by a signal handler after having written less than count bytes.</strong></p>
</blockquote>
<p>I'm not sure the best way to go about stress-testing this. I'm currently writing large batches of lines to a file and <code>SIGKILL</code>ing PHP midway through:</p>
<pre class=""lang-php prettyprint-override""><code>&lt;?php

$A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrtuvwxyz';

$line = str_repeat(&quot;$A\n$A&quot;, 5000);

$fd = fopen('linebuf.txt', 'w');

for (;;) {
    
    fwrite($fd, $line);
    
    flush();
    
    print '.';
    
}
</code></pre>
<p>I used the following suboptimal hack to do the <code>SIGKILL</code>ing:</p>
<pre class=""lang-sh prettyprint-override""><code>while :; do
  rm linebuf.txt
  timeout -s KILL 0.05 php linebuf.php
  [[ &quot;$(tail -c 1 linebuf.txt)&quot; != &quot;z&quot; ]] &amp;&amp; break
done
</code></pre>
<p>Using the above, I found that the lines <strong>always</strong> seem to be fully complete - there are no partial writes.</p>
<p><em><strong>However,</strong></em> I get the impression I'm seeing &quot;best case scenario&quot; behavior, and that my script may well be susceptible to partial writes if it were to encounter SIGKILL and/or SIGINT.</p>
<p>(I'm not sure if PHP's own buffering is relevant in this picture, but I did find <a href=""https://www.php.net/manual/en/function.stream-set-write-buffer.php#122748"" rel=""nofollow noreferrer"">a comment</a> on the <code>stream_set_write_buffer()</code> doc page noting that the function does not work on files, referencing an 18-year old bug. I also discovered that the function returns <code>-1</code> in my own testing.)</p>
<hr />
<p><strong>Further context/rationale</strong></p>
<p>I'm currently working on a backend script that loads a bunch of data from a slow-to-read data source. Iterating on this script is painfully slow: it currently takes around ~20 minutes to run (and that's before I tackle writing the part of the script that will actually process the data!).</p>
<p>The exceedingly obvious solution is to cache loaded data into a JSON or text file, then reread that (sequentially, at hundreds of MB/s) upon reload. Yes please.</p>
<p>However, the output of this particular script will affect everything else in the pipeline I'm building, so the integrity of the cache must be the same as the data source I'm reading from.</p>
<p>Elsewhere in this pipeline I frequently create temporary files then (close and) rename them into place (and delete all temporary files upon reload). Within this model, I might regenerate a few things, but I can reasonably prove (assuming sane hardware and environment) that I'll never see partially-written data.</p>
<p>I'm looking for a pattern that will allow me to maintain a similar level of correctness/confidence in a journaling/file-append context.</p>
<hr />
<p>(As an aside, I've seen a few scenarios where multi-threaded programs and/or multiple separate processes fight over stdout in a terminal, or kernel threads and userspace processes trip over each other in dmesg.</p>
<p>In such circumstances it seems very easy for output from one process to be mixed in with output from another, on the same line. I think this is occurring at the block size boundaries?)</p>
",https://stackoverflow.com/questions/68797760/can-newline-delimited-fwrites-be-truncated-partway-through-a-line-upon-sigint,"['php', 'signals']",63,False,1,0
Bottleneck in stress testing Node web server,"<p>This question is really bugging me for past few days and I have no logical explanation of this whatsoever. It came up after me testing out how epoll and libuv generally works in Node and by experimenting scalability of an express / http server. My tests were diversified into 2 segments.</p>
<ol>
<li>Creating http server with single Node process.</li>
<li>Creating http server with multiple Node processes trough clustering.</li>
</ol>
<p>I also had a 2nd stress testing server that used JMeter to stress test on how much concurrent connections can it handle per second.</p>
<p>single Node process code:</p>
<pre><code>const express = require('express')
var bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));


setInterval(function () {

    console.log(&quot;Per sec: &quot;+ currentSec);
    currentSec = 0

    console.log(&quot;------------------------&quot;)

}, 1000);


app.get('/', (req, res) =&gt; {
 currentSec++
 res.send(&quot;OK&quot;)
})
app.listen(3000, &quot;XXX.XXX.XXX.XXX&quot;);
</code></pre>
<p>multiple Node processes</p>
<pre><code>const express = require('express')
var bodyParser = require('body-parser')

var cluster = require('cluster');
var numCPUs = require('os').cpus().length;


if (cluster.isMaster) {


    setInterval(function () { //syncronizer , ram - file
    // i had some logic here for counting global per second
    }, 1000);


    for (var i = 0; i &lt; numCPUs; i++) {
        const worker = cluster.fork();
    }

} else {
    var app = express();

    app.get('/', async function (req, res) {
        res.send(&quot;ok&quot;)
        return
    });

    app.listen(3000, 'XXX.34.XXX.121');
}
</code></pre>
<p>Both codes were counting how much requests were incoming per second, but I've also had option to see it inside JMeter so it wasn't really a problem.
Before anything, I want to clarify that I made a very simple GET route on purpose as I wanted to test the load on simple web server that does not use help of any libuv threads which could stress out cores on machine even more, but rather using only main event loop thread to process socket writing which was the actually purpose of testing (understanding if bottleneck is in Kernel or rather in main event loop processing the application data) and managing to balance out 1 core per process as much as possible.</p>
<p>I've read quiet interesting documentations on how Node processes network I/O communication and the way it uses epoll to gather file descriptors which it uses after appending aplpication data to write towards socket with help of system calls. I've understood the complexity part of it and the fact that all socket writing and reading is being done by Kernel itself and not Node, leaving only Node to handle with application data layer and <strong>it doing non blocking system call later on when finished with simple processing</strong> after which Kernel uses to trigger driver calls towards network adapter. Upon receiving the data from client, Kernel gets triggered by hardware interrupts and then notifies epoll about changes in file descriptors, making the whole writing / read process pretty straightforward, abstractly at least.</p>
<p>Results that I've got were kind of shocking taking the fact that my guess on start was that Node would have the same result in both scenarios(either using multi processes or single process). My assumption was that the complexity of reading file descriptors, appending data to socket and getting information from Kernel upon some event such new socket opened would result same if there were multi cores involved into processing compared to just 1, making clustering pretty redundant in terms of processing <strong>simple http</strong> requests like that. My theory was that the overhead in ICP communication via pipe would be slowing it even more, making one thread, 1 process Node faster or same compared to multi core architecture via clustering. In my head, this was something like diversifying <code>for loop</code> that does 100k cycles of some math calculations towards 8 cores vs just using 1 core to do that in first place, assuming this 100k cycles operation was being triggered by some http event and then diversified around other cores from master process. In practice, this would work if there was no overhead in communication from a single process(in our case master server) that diversifies work towards 8 other cores, making it much faster to process with 1 core based on some event trigger like GET request in our case due to overheads in communication if we used multi cores for this. Operations that main event loop is doing when handling TCP socket and doing a system call seemed so trivial to me CPU complexity wise, that I thought achieving parallelism in terms of multicore usage was pretty redundant due to the fact that bottleneck in the end was Kernel which was doing all the final touch and sending socket out to the network driver and that Node's process was just doing small non blocking portion.</p>
<p>I imagined the process as follows (in this example lets look at this 1st scenario using just 1 Node process).</p>
<p><strong>Scenario number 1 (single process):</strong></p>
<p>JMeter triggers some number of requests, lets say N. Network adapter at server side receives it and does hardware interrupt towards Kernel where Kernel then notifies epoll that there are some new events which it has to handle, and then main event loop after some amount of time (lets say K) starts going trough all the events that came over and starts writting application data towards the socket.</p>
<p><a href=""https://i.stack.imgur.com/cGUB7.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/cGUB7.png"" alt=""Wait for epoll explained"" /></a></p>
<p>Upon gathering file descriptors and writting of application data (in this case &quot;ok&quot; content), it does system call to Kernel that socket is ready and that it's ready for send and then Kernel sends it over to network driver and then the packet is being sent over towards the client that did request in first place.</p>
<p><strong>What happens in scenario nr. 2 when it comes to multi processing and clustering?</strong></p>
<p>Even though every worker process is 'listening' on same port, in reality it's not like this. Master process and master's main event loop is the one that is listening on this port and all it does it registers workers in separate tcp communication channel, or pipe, depending on implementation to later on offload the socket application data appending, making the bottleneck just this main master process which uses 1 event loop same as in first scenario (<em>WHICH CREATED BIGGEST CONFUSION HERE!</em>).
Upon client sending over HTTP request, what happens <em><strong>I think</strong></em> for every request is pretty similar to first scenario. Kernel receives hardware interrupt, then it notifies epoll from first master process that new event occurred and then main event loop takes file descriptor it has to read from and what happens then is that main master process which forked all other clusters is offloading that file descriptor / work towards other processes in terms notifying it about some work they have to do (in this case, it <em>possibly</em> gives them file descriptor they have to manipulate with). By this, we achieve parallelism by using multi cores and actually trying to increase speed of processing something <strong>very simple</strong> in terms of CPU consumption which is <strong>non blocking system call and application data append</strong></p>
<p><strong>RESULTS</strong></p>
<p>Before mentioning anything, I was testing this on 8core CPU server with 16GB ram and 1/1Gbps bandwith.
JMeter was using another exactly same spec machine.
Every request had no <code>keep-alive</code> header, meaning that sockets were reopening every time.
RTT was aprox 8 ms between client and server.</p>
<p><em>1st scenario using server running on 1 Node process(with 1 main event loop).</em></p>
<p>Server was receiving and processing approximately 2,500 - 3,500 concurrent connections per second.</p>
<p><em>2nd scenario using server running on 8 Node processes(with 8 main event loops).</em></p>
<p>Server was receiving and processing approximately 11,00 - 13,000 concurrent connections per second.</p>
<p><em><strong>CONFUSIN SUMMARIZED</strong></em></p>
<p>Based on all the things I researched about and taking the fact that all  these processes do is simple non blocking system requests, my question is, how is it possible that 8 processes managed to achieve better result taking in consideration that bottlenecks were the same in both tests? Bottleneck on global level is Kernel - OS and in our application (both scenarios) its a Node server listening on some particular port using 1 main event loop and epoll to poll the ready sockets. In first scenario we had 1 process listening on port 3000 (1 main event loop) and in second scenario we had also 1 process(main master) with its main event loop listening on port 3000 and offloading every request to workers to fill that file descriptor - &gt;&gt; socket with application data and then finish off with system call. It just doesn't make sense to me that 8 processes performed better then this 1 process in first scenario taking the fact that operations they had to do when receiving event from epoll are very trivial which in the end are just non blocking system calls.</p>
<p><strong>My unconfirmed explanation why it happened?</strong></p>
<p>Lets assume that network adapter due to high bandwidth and low message size can accept much more then 10,000 connections per second(in our case). Now it gets me to a point where only explanation for this is that all articles I've read about clustering and the way of how complex operations for I/O networking that main event loop is doing are very untrue. Assuming 1 node process achieved 3,000 concurrent requests and 8 processes did 12,000 explains that it indeed managed to process more connections by providing more core power to process <code>something</code> under the hood after epoll received file descriptor. Every article I've read so far explained that this process is not CPU heavy at all as it only does <strong>simple non blocking system call after it receives descriptors and fills application data</strong>. My only explanation is that before the system call, filling application data is <strong>INDEED CPU heavy in some way</strong> and I need someone to actually point me in the right direction. Also, there might be a possibility that articles were wrong when they were referring that master process is sending out file descriptors / socket locations to other worker processes, but rather I think there might be a chance that on start when Node is started it just registers all 8 different epolls to Kernel so when new request comes in, it does some round robin principle and it is informing 8 different epoll listeners about new request and not going trough master process directly(just my guess). By this, we achieve multi core parallelism for handling expensive operation, which is possibly data application appending towards socket. If this is true and that there are actually 8 different epoll listeners, then this means that processing I/O network socket and writing application data is indeed heavy and that bottleneck is rather in Node application and how it processes sockets and appends application data before doing system calls.</p>
<p>Does someone have any logical explanation for this?</p>
",https://stackoverflow.com/questions/65704218/bottleneck-in-stress-testing-node-web-server,"['node.js', 'multithreading', 'express', 'node-modules', 'libuv']",220,False,0,0
