Code Monkey home page Code Monkey logo

Comments (6)

cgordon avatar cgordon commented on June 1, 2024 1

That is a great idea. I've been working on a new version of bender that uses more idiomatic Go (and less memory). I have rewritten the core loop (and have been using it for a new project), but I haven't (yet) had time to rewrite the HTTP and Thrift tutorials to use it. You can take a look here: https://github.com/cgordon/bender.

As I get time this week, I'll try to add some other new things, including a simple JSON output format for the timing events and some Python tools to generate useful statistics from that output.

from bender.

earlgreyz avatar earlgreyz commented on June 1, 2024 1

@cgordon since you've been working on a new version could you consider allowing user to provide their own time measure checkpoints (optional)?

Setup before sending a request might take a long time and interfere the results. I've encountered that while doing simple UDP loadtests (I've stripped not important parts):

func UDPExecutor(_ int64, request interface{}) (interface{}, error) {
	datagram := request.(*Datagram)

	// This part can take quite long and we'd like to ignore it in time measures
	conn, err := net.Dial("udp", addr)
	if err != nil {
		return nil, err
	}
	defer conn.Close()

	// Start measure here
	conn.SetWriteDeadline(time.Now().Add(timeout))
	_, err = conn.Write(datagram.Data)
	if err != nil {
		return nil, err
	}

	buffer := make([]byte, bufferSize)
	conn.SetReadDeadline(time.Now().Add(timeout))
	n, err := conn.Read(buffer)
	if err != nil {
		return nil, err
	}

	return buffer[:n], nil
}

My "temporary fix" was to calculate it manually and return the results as a struct

// Response represents a udp response received
type Response struct {
	Start   time.Time
	End     time.Time
	Elapsed time.Duration
	Data    []byte
}

But it also means that histogram and other recorders need to be adjusted for this new format. It would be really good to have a generic solution to this.

from bender.

cgordon avatar cgordon commented on June 1, 2024 1

@earlgreyz That's an interesting idea. I've been having the request generator do all the initialization for our load testing, and passing everything into the executor, but I can see how you may want to avoid that here. It looks like the easiest option to make this work would be to redefine the RequestExecutor to return four values: the response, the start time, the end time and an error. Then, rather than the main loop tracking the start and end time, the request executor would need to do so. In that case, it would also be easy to write a little wrapper function that did the timing (for people who don't need that fine control). Does that sound like it would do what you want?

from bender.

earlgreyz avatar earlgreyz commented on June 1, 2024 1

@cgordon yes, that seems like a good solution

from bender.

earlgreyz avatar earlgreyz commented on June 1, 2024

I can prepare a PR if it is agreed on, but it will most likely break the backwards compatibility.

from bender.

jparise avatar jparise commented on June 1, 2024

I think that would be a good improvement. Any opinion, @cgordon?

from bender.

Related Issues (11)

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.