You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

SearchAPI is a webapp implemented with FastAPI, that work over a ASGI (Asynchronous Server Gateway Interface), do to simplicity of execution currently that role is being fulfil by and embedded version of Uvicorn, but any ASGI can be use as server. All communication via API ha to pass through a security layer (implementations available Local, LDAP, OIDC and external JWT Verification (JWKS)). Engine Manager will manage all connections and requests to the Non-SQL engines, making them available anywhere in the code to use. The pipeline manager will hold the pipeline implementations and the pipeline can make request to third party services.


Difference Between ASGI and WSGI

WSGI (Web Server Gateway Interface) and ASGI (Asynchronous Server Gateway Interface) are both specifications for communication between web servers and web applications or frameworks in Python. However, there are significant differences between the two:

  1. Design and Architecture:

    • WSGI: WSGI is a synchronous interface that was introduced earlier and is designed for synchronous web servers and applications. It operates on a request-response cycle, where each request is processed sequentially and blocks the server until a response is sent.
    • ASGI: ASGI is an asynchronous interface that allows for handling multiple concurrent requests and performing non-blocking I/O operations. It supports both synchronous and asynchronous application frameworks and servers.
  2. Concurrency and Scalability:

    • WSGI: WSGI servers typically use a multi-process or multi-threaded model to handle concurrent requests. However, due to the synchronous nature of WSGI, scalability is limited, especially when dealing with long-lived connections or handling a large number of concurrent connections.
    • ASGI: ASGI is designed to support asynchronous frameworks and servers, which enable more efficient concurrency and scalability. It can handle a higher number of concurrent connections and is well-suited for real-time applications, long-polling, and WebSockets.
  3. Middleware Support:

    • WSGI: WSGI has a mature ecosystem of middleware components and frameworks built around it. Many popular Python web frameworks, such as Flask and Django, are built on top of WSGI.
    • ASGI: ASGI also has a growing ecosystem of middleware components and frameworks, but it is relatively newer compared to WSGI. Some frameworks, such as FastAPI and Starlette, are designed specifically for ASGI.
  4. Support for Asynchronous Programming:

    • WSGI: WSGI is primarily designed for synchronous programming, and asynchronous programming is not directly supported. However, some frameworks provide workarounds or integration with asynchronous libraries through custom extensions.
    • ASGI: ASGI natively supports both synchronous and asynchronous programming. It allows developers to write asynchronous code using features like coroutines, async/await syntax, and libraries such as asyncio.

In summary, WSGI is a synchronous interface designed for traditional web servers and applications, while ASGI is an asynchronous interface designed to handle high concurrency and support both synchronous and asynchronous frameworks and servers. ASGI provides better scalability and performance for real-time and high-traffic applications compared to WSGI.

  • No labels