GithubHelp home page GithubHelp logo

Comments (2)

vladmunteanu avatar vladmunteanu commented on July 24, 2024

@mabdelndi can you please post a short usage example that reproduces this?

from th2c.

mabdelndi avatar mabdelndi commented on July 24, 2024

Actually the thing is that when trying to send request continuosly for 60 seg, it stops sending them at a certain time, as i obeserved around 40 seg. What im doing to reproduce this is just using the test_local_many() from your code and adapting it

@gen.coroutine
def test_local_many(n):

    cond = CounterCondition()
    timeout = time.time() + 60
    msisdnoffset = 2000000
    mbrDownlink = 500000
    mbrUplink = 500000
    i = 0

    #def future_done(future):
    #    try:
    #        r = future.result()
    #    except Exception as e:
    #        r = e

    #    logging.info(['REQUEST FINISHED', r])

    #    cond.increment(value=1)

    client = AsyncHTTP2Client(
        host='136.225.76.236', port=8543, secure=False,
        verify_certificate=False, max_active_requests=10,
        auto_reconnect=False, auto_reconnect_interval=1
    )

    #client.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")

    st = time.time()
    while time.time() < timeout:
	sub_ip_addr = str(IPv4Address(getrandbits(32))) # Generates random IPv4 for every subscriber

	msisdnoffset = msisdnoffset +1
	mbrUplink = mbrUplink + 1
         
	mbrUplink = mbrUplink + 1

        i = i +1

	jason = '{)'
        
	req_put_create = HTTPRequest(
        url='',
            method='PUT',
            request_timeout=0.01,
            body=jason
           )
        req_put_create.headers.parse_line("Content-Type: application/json")
        try:
        	response = yield client.fetch(req_put_create)
                print(i)
        except Exception as e:
                print("Error: %s" % e)
		print(mbrUplink)
    
    
    print("tiempo cumplido") 

    try:
       yield cond.wait_until(n)
    except Exception:
       logging.error('Something bad happened', exc_info=True)

    logging.info(['FINISHED', n, 'requests in', time.time() - st])

class CounterCondition(object):
    def __init__(self):
        self.condition = Condition()
        self.counter = 0

    def increment(self, value=1):
        self.counter += value
        self.condition.notify_all()

    @gen.coroutine
    def wait_until(self, value):
        while True:
            yield self.condition.wait()
            if self.counter >= value:
                self.counter -= value
                return


@gen.coroutine
def main():
    try:
        yield test_local_many(1000)
        # yield test_local()
    except Exception:
        logging.error('Test failed', exc_info=True)


if __name__ == '__main__':
    IOLoop.current().run_sync(main)

As you can see using a timeout of 60 seg i send conitnuosly reqs and at some point it breaks and the write buffer stops sending requests. you can reproduce it with this code.

If you need anything else, or more details in the part that is failing in the code let me know

from th2c.

Related Issues (9)

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.