Comments (2)
Hi @ram-vet,
There is console.time() and console.timeEnd() pair for njs CLI. Otherwise there no profiling tools specific to njs.
Please elaborate what you are trying to profile and what part of nginx/njs you are trying to measure.
from njs.
Hi @ram-vet
I wrote a little profiling tool for another NGINX user / customer.
https://gist.github.com/tippexs/59cc1a2d2e2b909947ba22a63608a90b
It is not in an state where it would make sense to call it a tool but what you can basically do with it is measure execution times of NJS functions and write them to a file.
$ ~> node index.js
event1: Min: 1, Middle 80.52228112910159, Max: 305, Std. Deviation: 44.29781599231003, Start: 167116922931, End: Start: 167116926031
event2 server 1: Min: 0, Middle 1.2707481005260082, Max: 101, Std. Deviation: 4.78749625209064, Start: 167116922872, End: Start: 167116926027
event3 server 2: Min: 1, Middle 78.99934512115259, Max: 294, Std. Deviation: 41.49847599276098, Start: 167116922931, End: Start: 167116926031
File successfully created!
File successfully created!
It will generate a log file and a little NodeJs application can actually create diagrams like this one.
All of this is very hacky :D and I feel very bad sharing the code as it will be (with a very high chance) the most ugliest piece of code you have ever seen in your live. Not kidding.
But let me know if this sounds useful to you. Happy to upload the stuff to a github repository.
from njs.
Related Issues (20)
- How to implement an external rate limitter? HOT 2
- njs_string_atob cannot handle cypertext unless the padding is intact HOT 1
- Add Support for js_balancer like balancer_by_lua_block HOT 2
- How to remove or override value of 'Server' header for all locations. HOT 10
- Introducing QuickJS engine as alternative JS engine. HOT 7
- ngx.shared.SharedDict.clear() hangs when called on an empty dict HOT 1
- NJS call wrong function. HOT 7
- Sending a Buffer with r.send() does not work HOT 1
- Repo looks empty
- Test failure with zlib-ng HOT 6
- False Positive Duplicate Checker Warning HOT 3
- njs source code compile error HOT 2
- Port missing in Host header when using ngx.fetch with non-standard port HOT 3
- Add support for a fetch-like API for TCP (and UDP) sockets.
- Add support for statefiles to js_shared_dict_zone.
- r.requestText.replaceAll replaces only first occurence of string HOT 1
- http request from js_body_filter njs script HOT 1
- Segfault at String.prototype.replaceAll HOT 2
- Segfault at Array.prototype.toSpliced HOT 1
- closed request followed by 400 response HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from njs.