Git Product home page Git Product logo

Comments (2)

xeioex avatar xeioex commented on August 20, 2024

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.

tippexs avatar tippexs commented on August 20, 2024

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.

image

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.