k6 https://k6.io/ tool reports negative http_req_duration time - k6

I am trying to run very simple scenario with k6 tool.
Sometimes it reports negative number for http_req_duration time which is confusing me.
QUESTION: How is that possible or how to interpret negative number in this context?
The description of http_req_duration metric in official doc says
http_req_duration - Total time for the request. It's equal to http_req_sending + http_req_waiting + http_req_receiving (i.e. how long did the remote server take to process the request and respond, without the initial DNS lookup/connection times). float
My test script looks like this:
script.js
import { check } from 'k6';
export let options = {
thresholds: {
http_req_duration: ['avg < 200', 'p(99)<1000', 'p(99.999)<1000'],
},
};
export default function () {
var res = http.get('http://pong/ping/k6');
check(res, {
'is status 200': (r) => r.status === 200,
'is duration <= 1000ms': (r) => r.http_req_duration < 1000
});
}
docker-compose.yaml
---
version: "3"
services:
pong:
image: "ludenus/pong:0.0.1"
ports:
- "8100:80"
environment:
PONG_LISTENING_ADDRESS: ":80"
k6:
image: "loadimpact/k6:0.30.0"
volumes:
- ./script.js:/script.js
command: run /script.js --vus 2000 --duration 10s
depends_on:
- pong
k6_1 | checks.....................: 0.00% ✓ 0 ✗ 133631
k6_1 | data_received..............: 18 MB 1.8 MB/s
k6_1 | data_sent..................: 10 MB 1.0 MB/s
k6_1 | http_req_blocked...........: avg=47.03µs min=13.6µs med=20.8µs max=46.11ms p(90)=27.1µs p(95)=33.5µs
k6_1 | http_req_connecting........: avg=3.96µs min=0s med=0s max=34.35ms p(90)=0s p(95)=0s
k6_1 | ✓ http_req_duration..........: avg=14.05ms min=-15.7758ms med=11.71ms max=163.09ms p(90)=27.25ms p(95)=33.93ms
k6_1 | http_req_receiving.........: avg=108.11µs min=-34.2818ms med=48.4µs max=87.86ms p(90)=83.3µs p(95)=112.6µs
k6_1 | http_req_sending...........: avg=47.79µs min=11.6µs med=20.5µs max=56.39ms p(90)=32.8µs p(95)=45.6µs
k6_1 | http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
k6_1 | http_req_waiting...........: avg=13.89ms min=0s med=11.56ms max=163.01ms p(90)=27.02ms p(95)=33.66ms
k6_1 | http_reqs..................: 133631 13350.537278/s
k6_1 | iteration_duration.........: avg=14.9ms min=287.4µs med=12.32ms max=227.44ms p(90)=28.72ms p(95)=35.79ms
k6_1 | iterations.................: 133631 13350.537278/s
k6_1 | vus........................: 200 min=200 max=200
k6_1 | vus_max....................: 200 min=200 max=200

this seems like a minor bug in k6. I've created an issue about it: https://github.com/loadimpact/k6/issues/1872
As I mentioned in the issue, this is likely a case where the server starts responding before we have completely sent it the whole request. Can you please share any relevant details that would help us reproduce the problem in the GitHub issue, e.g. what server and app are you testing, OS and networking details, etc.

Related

OpenStack Mistral workflow error while executing using GUI

I am getting error while executing OpenStack simple mistral workflow on OpenStack(wallaby) devstack environment. While I can execute the workflow from CLI command and got success But it fails if I try the same thing with GUI
root#openstack:~# openstack workflow definition show test_get
---
version: '2.0'
test_get:
description: Test Get.
tasks:
my_task:
action: std.http
input:
url: http://www.google.com
root#openstack:~# openstack workflow execution create test_get
+--------------------+--------------------------------------+
| Field | Value |
+--------------------+--------------------------------------+
| ID | 482e3803-45ef-411e-a0f4-1427abfc8649 |
| Workflow ID | 9dc0d4a4-8c5b-4288-8126-e1147da3bd02 |
| Workflow name | test_get |
| Workflow namespace | |
| Description | |
| Task Execution ID | <none> |
| Root Execution ID | <none> |
| State | RUNNING |
| State info | None |
| Created at | 2021-06-21 16:58:54 |
| Updated at | 2021-06-21 16:58:54 |
| Duration | ... |
+--------------------+--------------------------------------+
But while executing in GUI I get **
Execution is missing field "workflow_identifier"
**
Faced the same issue in Yoga release. Spent a few hours to investigate it and found interesting thing:
/usr/local/lib/python3.8/dist-packages/mistralclient/api/v2/executions.py
class ExecutionManager(base.ResourceManager):
resource_class = Execution
def create(self, wf_identifier='', namespace='',
workflow_input=None, description='', source_execution_id=None,
**params):
self._ensure_not_empty(
workflow_identifier=wf_identifier or source_execution_id
)
But! in the webform we are using workflow_identifier instead of wf_identifier
/usr/local/lib/python3.8/dist-packages/mistraldashboard/workflows/forms.py
def handle(self, request, data):
try:
data['workflow_identifier'] = data.pop('workflow_name')
data['workflow_input'] = {}
for param in self.workflow_parameters:
value = data.pop(param)
if value == "":
value = None
data['workflow_input'][param] = value
ex = api.execution_create(request, **data)
FIX is to rename workflow_identifier to wf_identifier in the form like
data['wf_identifier'] = data.pop('workflow_name')
After that mistral-dashboard works fine with execution creating.

kusto function to parse json which is number

i could not able to parse the below json value , I tried with parse_json() and todynamic() ,I m getting the result column values to be empty
]1
the issue is that your payload includes an internal invalid JSON payload.
it is possible to "fix" it using the query language (see usages of replace() in the example below), however it'd be best if you can write a valid JSON payload to begin with.
try running this:
print s = #'{"pipelineId":"63dfc1f6-5a43-5bca-bffe-6a36a435e19d","vmId":"9252382a-814f-4d02-9b1b-305db4caa208/usl-exepipe-dev/westus/usl-exepipe-lab-dev/asuvp306563","artifactResult":{"Id":"execution-job-2","SourceName":"USL Repository","ArtifactName":"install-lcu","Status":"Succeeded","Parameters":null,"Log":"[{\"code\":\"ComponentStatus/StdOut/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning succeeded\",\"message\":\"2020-06-02T14:33:04.711Z | I | Starting artifact ''install-lcu''\r\n2020-06-02T14:33:04.867Z | I | Starting Installation\r\n2020-06-02T14:33:04.899Z | I | C:\\USL\\LCU\\4556803.msu Exists.\r\n2020-06-02T14:33:04.914Z | I | Starting installation process ''C:\\USL\\LCU\\4556803.msu /quiet /norestart''\r\n2020-06-02T14:43:14.169Z | I | Process completed with exit code ''3010''\r\n2020-06-02T14:43:14.200Z | I | Need to restart computer after hotfix 4556803 installation\r\n2020-06-02T14:43:14.200Z | I | Finished Installation\r\n2020-06-02T14:43:14.200Z | I | Artifact ''install-lcu'' succeeded\r\n\",\"time\":null},{\"code\":\"ComponentStatus/StdErr/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning succeeded\",\"message\":\"\",\"time\":null}]","DeploymentLog":null,"StartTime":"2020-06-02T14:32:40.9882134Z","ExecutionTime":"00:11:21.2468597","BSODCount":0},"attempt":1,"instanceId":"a301aaa0c2394e76832867bfeec04b5d:0","parentInstanceId":"78d0b036a5c548ecaafc5e47dcc76ee4:2","eventName":"Artifact Result"}'
| mv-expand log = parse_json(replace("\r\n", " ", replace(#"\\", #"\\\\", tostring(parse_json(tostring(parse_json(s).artifactResult)).Log))))
| project log.code, log.level, log.displayStatus, log.message

How to remove steps from checkout in Sylius

I'm using sylius/sylius 1.3.9 with symfony/framework-bundle 4.2.4. Regarding the doc to remove states from checkout you have to replace the whole configuration of the Sylius core bundle.
I put my configuration into src/Resources/SyliusCoreBundle/config/app/state_machine/sylius_order_checkout.yml:
winzou_state_machine:
sylius_order_checkout:
class: '%sylius.model.order.class%'
property_path: checkoutState
graph: sylius_order_checkout
state_machine_class: '%sylius.state_machine.class%'
states:
cart: ~
addressed: ~
completed: ~
transitions:
address:
from: [cart, addressed]
to: addressed
complete:
from: [addressed]
to: completed
callbacks:
after:
sylius_process_cart:
on: [address]
do: ['#sylius.order_processing.order_processor', process]
args: [object]
sylius_create_order:
on: [complete]
do: ['#sm.callback.cascade_transition', apply]
args: [object, event, create, sylius_order]
sylius_save_checkout_completion_date:
on: [complete]
do: [object, completeCheckout]
args: [object]
After that I execute:
php bin/console cache:clear -e dev
[...]
php bin/console debug:winzou:state-machine sylius_order_checkout -e dev
+--------------------+
| Configured States: |
+--------------------+
| cart |
| addressed |
| shipping_selected |
| shipping_skipped |
| payment_skipped |
| payment_selected |
| completed |
+--------------------+
[...]
Nothing changed. When I follow the link in the doc it says:
Bundle inheritance was removed in Symfony 4.0 [...]
So is it still possible with Symfony 4.2 to replace a whole configuration file of a bundle like suggested by the docs or is this a regression in Sylius 1.3 and what would be a possible solution if I did nothing wrong?
You can try to create state_machine directory in config/packages, put your YAML file and add this line in configureContainer() method into src/Kernel:
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
...
$loader->load($confDir.'/state_machine/*'.self::CONFIG_EXTS, 'glob');
}

Cannot start container in JBoss Fuse 6.0.0

I try to running old JBoss Fuse (6.0.0.redhat-024) server which installed some containers inside
JBossFuse:karaf#myapps> fabric:container-list
[id] [version] [alive] [profiles] [provision status]
myapps* 1.1 true fmc, fabric, fabric-ensemble-0000-1, jboss-fuse-full success
managed1 1.1 false default, myprofile success
managed2 1.1 false default, myprofile success
I tried to start managed1 and managed2 but they seems cannot started and also the log tells nothing.
JBossFuse:karaf#myapps> fabric:container-start managed1
JBossFuse:karaf#myapps> fabric:container-start managed2
JBossFuse:karaf#myapps> fabric:container-list
[id] [version] [alive] [profiles] [provision status]
myapps* 1.1 true fmc, fabric, fabric-ensemble-0000-1, jboss-fuse-full success
managed1 1.1 false default, myprofile success
managed2 1.1 false default, myprofile success
JBossFuse:karaf#myapps> log:tail
.........
2016-10-20 22:23:51,148 | INFO | l Console Thread | FabricServiceImpl | ? ? | 57 - org.fusesource.fabric.fabric-core - 7.2.0.redhat-024 | Starting container managed1
2016-10-20 22:23:56,221 | INFO | l Console Thread | FabricServiceImpl | ? ? | 57 - org.fusesource.fabric.fabric-core - 7.2.0.redhat-024 | Starting container managed2
After read the logs, i found an error during starting fuse:
20:17:09,542 | ERROR | guration Watcher | NIOServerCnxnFactory | 53 - org.fusesource.fabric.fabric-linkedin-zookeeper - 7.2.0.redhat-024 | Thread Thread[ActiveMQ Configuration Watcher,5,org.jboss.amq.mq-fabric-6.0.0.redhat-024] died
java.lang.NullPointerException
at org.fusesource.mq.fabric.ActiveMQServiceFactory$ConfigThread$$anonfun$run$3.apply(ActiveMQServiceFactory.scala:400)[128:org.jboss.amq.mq-fabric:6.0.0.redhat-024]
at org.fusesource.mq.fabric.ActiveMQServiceFactory$ConfigThread$$anonfun$run$3.apply(ActiveMQServiceFactory.scala:399)[128:org.jboss.amq.mq-fabric:6.0.0.redhat-024]
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:102)[56:scala-library:2.9.1]
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:102)[56:scala-library:2.9.1]
at scala.collection.Iterator$class.foreach(Iterator.scala:660)[56:scala-library:2.9.1]
at scala.collection.mutable.HashTable$$anon$1.foreach(HashTable.scala:157)[56:scala-library:2.9.1]
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:190)[56:scala-library:2.9.1]
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:43)[56:scala-library:2.9.1]
at scala.collection.mutable.HashMap$$anon$2.foreach(HashMap.scala:102)[56:scala-library:2.9.1]
at org.fusesource.mq.fabric.ActiveMQServiceFactory$ConfigThread.run(ActiveMQServiceFactory.scala:399)[128:org.jboss.amq.mq-fabric:6.0.0.redhat-024]
What is happening and how to start the containers?

Error!: SQLSTATE[42000] [1226] ‘max_user_connections’ resource (current value: 30), but max_user_connections is configured to 1000

Visitors get a Mysql error when a mysql user has exceeded the max_user_connections, returning the current value as 30, but max_connections and max_user_connections are set to 1000. When the problem occurs, the CPU reaches almost 98 %.
On mysql error logs we received a lot of access denied errors from another user, around 5000 denied connections. My problem is not why the PHP script takes all these connections, but to know why the configured variables, max_user_connections and max_connections are not applied. Those are configured to 1000, but the error message returns 30. How it is possible ?
I activated log_warnings=2, to get more information, but we don't get an extra information. Any idea why this behavior ? or How to audit mysql to find the source of this problem ?
The error message received is :
Error!: SQLSTATE[42000] [1226] User ‘some_user’ has exceeded the ‘max_user_connections’ resource (current value: 30)
select ##session.max_user_connections, ##global.max_connections;
+--------------------------------+--------------------------+
| ##session.max_user_connections | ##global.max_connections |
+--------------------------------+--------------------------+
| 1000 | 1000 |
+--------------------------------+--------------------------+`
show global variables like '%connections%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| extra_max_connections | 1 |
| max_connections | 1000 |
| max_user_connections | 1000 |
+-----------------------+-------+
show status like '%connected%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 4 |
+-------------------+-------+
select user,max_user_connections from mysql.user where host='localhost'\G
user: some_user
max_user_connections: 0
user: another_user
max_user_connections: 0`
The error seems to be :
Error: 1226 SQLSTATE: 42000 (ER_USER_LIMIT_REACHED)
Message: User '%s' has exceeded the '%s' resource (current value: %ld)
and not :
Error: 1203 SQLSTATE: 42000 (ER_TOO_MANY_USER_CONNECTIONS)
Message: User %s already has more than 'max_user_connections' active connections
We are using MariaDB, version :
select version();
+------------------------+
| version() |
+------------------------+
| 5.5.44-MariaDB-cll-lve |
+------------------------+
Solution :
You can reproduce the error with the following command :
mysqlslap -a --concurrency=500 --number-of-queries 5000 --iterations=500 --engine=innodb --debug-info -utest -p
The problem was caused by Governor, we have Cloudlinux installaed on the server, but this option was set OFF by default, but in this server was set to abusers. If the CPU is higher that 400 Gobernor set the max_user_connections for the user at 30.
You can check the logs on /var/log/dbgovernor-restrict.log
The solution si to set correctly this value or set off
dbctl --lve-mode off
/etc/container/mysql-governor.xml
<lve use="abuser"></lve>
<restrict level1="60s" level2="15m" level3="1h" level4="1d"
timeout="1h" log="/var/log/dbgovernor-restrict.log"
user_max_connections="30"></restrict>
<statistic mode="on"></statistic>
<default>
<limit name="cpu" current="400" short="380" mid="350" long="300">
</limit>

Resources