Skip to content

A tool for profiling HTTPX using cProfile and SnakeViz

License

Notifications You must be signed in to change notification settings

florimondmanca/httpxprof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

httpxprof

A tool for profiling HTTPX using cProfile and SnakeViz. No maintenance intended.

Installation

  • Install the version of HTTPX you'd like to profile against.
  • Install this tool using pip:
pip install -e git+https://github.com/florimondmanca/httpxprof#egg=httpxprof

Usage

# Run one of the built-in profiling cases:
httpxprof run async_client

# View results:
httpxprof view async_client

You can also:

  • Run your profiling cases by passing Python scripts — useful to profile other HTTP client libraries.
  • Profile against an HTTPS server using the --https option.
# aiohttp_single.py
import aiohttp
import ssl

import httpxprof


async def main(config: httpxprof.Config) -> None:
    ssl_context = ssl.create_default_context(cafile=config.client_cert())
    async with aiohttp.ClientSession() as session:
        for _ in config.requests():
            async with session.get(config.url, ssl=ssl_context):
                pass
httpxprof run --https aiohttp_session.py
httpxprof view aiohttp_session.py

You can ask for --help on httpxprof and any of the subcommands.

About

A tool for profiling HTTPX using cProfile and SnakeViz

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published