Git Product home page Git Product logo

Comments (1)

trentm avatar trentm commented on June 13, 2024

Thanks. I poked a little bit -- mostly me learning some about opbeans-node and opbeans-loadgen -- and I don't see any obvious normal reason why the "GET /api/customers" endpoint code could have a long delay at the end:

app.get('/customers', function (req, res) {
redis.get('customers', function (err, obj) {
if (err) apm.captureError(err)
else if (obj) return res.json(obj)
const limit = req.query.limit || 1000
const sql = 'SELECT * FROM customers LIMIT $1'
db.pool.query(sql, [limit], function (err, result) {
if (err) return error(err, res)
res.json(result.rows)
})
})
})

  • There is the separate handler to redirect "/api" requests 50% of the time that I'm not at all familiar with:

    opbeans-node/server.js

    Lines 86 to 109 in a052ed7

    app.use('/api', function (req, res, next) {
    if (Math.random() > opbeansRedirectProbability) {
    return next()
    }
    const service = opbeansServiceUrls[Math.floor(Math.random() * opbeansServiceUrls.length)]
    const opts = {
    method: req.method,
    hostname: service.hostname,
    port: service.port,
    path: req.originalUrl
    }
    req.log.debug('proxying request: %s => %s:%s', req.originalUrl, opts.hostname, opts.port + opts.path)
    const clientReq = http.request(opts)
    clientReq.on('response', clientRes => {
    res.writeHead(clientRes.statusCode, clientRes.headers)
    clientRes.pipe(res)
    })
    req.pipe(clientReq)
    })
  • and the app.get('*', ... routing pattern that I'm not familiar with:
    app.get('*', function (req, res, next) {
  • I noticed that some of the other opbeans-$lang services also have some slow outliers as well.
  • The slow transactions on edge today are all "GET /api/customers".

tl;dr: I don't have much useful info. @alex-fedotyev If something changes to either make this a higher prio or if you notice a behaviour change, please mention it here.

from opbeans-node.

Related Issues (17)

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.