Fauie Technology

eclectic blogging, technology and hobby farming

Tag: api

Five Features of a Successful API Platform – PDF

'API Culture'

I've coined this phrase to help indicate a healthy technology organization that strives to build a solid set of capabilities that can be leveraged across a wider audience than an engineering team typically gets.

Building an API is more than just writing a web service.  It's more than using AJAX or using a REST Framework within your code.  Building an 'API Culture' is all about providing your development teams the structure and ability to be as effective as they can be.  Increase collaboration, increase code quality and increase the reuse of applications that they build.  We're not talking about a specific tool or methodology, instead, we're talking about an attitude that your teams will adopt in order to enjoy their day to day working life a lot more.

Read the rest after a free download –

    redis-py: Connection Pool with unix sockets

    This is a note for myself in the future.
    When using redis-py ( https://github.com/andymccurdy/redis-py ), connection pools help save resources.
    The construct for connection pools with unix sockets is a little different.

    Normal connection with a unix socket:

    import redis
    r_server = redis.Redis(unix_socket_path='/tmp/my_redis.sock')

    Normal connection pooling:

    import redis
    pool = redis.ConnectionPool( )
    r_server = redis.Redis(connection_pool=pool)

    Logical connection pool with unix socket:

    import redis
    pool = redis.ConnectionPool(unix_socket_path='/tmp/my_redis.sock' )
    r_server = redis.Redis(connection_pool=pool)

    actual code to use unix sockets and connection pools:
    import redis

    from redis.connection import UnixDomainSocketConnection
    pool = redis.ConnectionPool(connection_class=UnixDomainSocketConnection, path='/tmp/my_redis.sock')
    r_server = redis.Redis(connection_pool=pool)

    Of note, specifying which connection class, instead of redis code figuring it out… and the renaming of the unix_socket_path.
    Forking now, sending back shortly.

    © 2021 Fauie Technology

    Theme by Anders NorenUp ↑