• Async options for flask app

    From Rimu Atkinson@21:1/5 to All on Mon Sep 18 10:59:15 2023
    Hi all,

    I'm writing a fediverse server app, similar to kbin https://kbin.pub/en
    and lemmy https://join-lemmy.org/. It's like reddit except anyone can
    run a server in the same way email works. This architecture involves a
    lot of inter-server communication, potentially involving thousands of
    different servers.

    So, lots of network I/O. Lots of tasks running in parallel to do I/O
    with different servers simultaneously. A fair bit of DB access too.

    The current fashion is to do this with cooperative multitasking (async/await/gevent/etc) to avoid the overhead associated with
    continually context switching threads and processes. Correct me if I'm
    wrong.

    How can I do this with Flask? Any async/await tricks? Can I just
    configure gunicorn to use gevent worker threads? https://flask.palletsprojects.com/en/2.3.x/deploying/gunicorn/

    Has anyone tried Quart? https://pypi.org/project/quart/

    How well does gevent monkey-patch into a Flask app?

    A penny for your thoughts

    Thanks!

    R

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to python-list@python.org on Mon Sep 18 14:17:52 2023
    On Mon, 18 Sept 2023 at 13:45, Rimu Atkinson via Python-list <python-list@python.org> wrote:

    Hi all,

    I'm writing a fediverse server app, similar to kbin https://kbin.pub/en
    and lemmy https://join-lemmy.org/. It's like reddit except anyone can
    run a server in the same way email works.

    And the part you didn't say: It's like Reddit but without a ridiculous
    API fee. Right? :)

    The current fashion is to do this with cooperative multitasking (async/await/gevent/etc) to avoid the overhead associated with
    continually context switching threads and processes. Correct me if I'm
    wrong.

    I wouldn't say "current fashion", but yes, there is significant
    benefit in putting more than one task onto any given thread. (Most
    likely, if you want maximum throughput, you'll end up wanting a
    two-level multiplexer, with a pool of processes, each one managing a
    pool of tasks.)

    How can I do this with Flask? Any async/await tricks? Can I just
    configure gunicorn to use gevent worker threads? https://flask.palletsprojects.com/en/2.3.x/deploying/gunicorn/

    It's been a while since I did it, but it definitely does work, yes.

    Has anyone tried Quart? https://pypi.org/project/quart/

    Not me, so I'll let someone else answer that.

    How well does gevent monkey-patch into a Flask app?


    Here's one where I've done that: https://github.com/rosuav/mustardmine

    However, it's worth noting that (a) the exact details might differ
    depending on precisely what you use - this is backed by PostgreSQL and
    also uses websockets; and (b) I originally did this quite a while ago,
    and things may have gotten easier since then. All I know is, it works
    if I do it this way, and I haven't felt the urge to mess with that
    part of it. You may notice that my README mentions issues with Python
    3.8 from back when that was new :)

    But with all of those caveats: Yes, this absolutely does work, and I
    make use of the Mustard Mine on a regular basis. It gets updates
    occasionally, not often, but I bump it onto newer Pythons every now
    and then, so the techniques it uses should still be valid.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam Parker@21:1/5 to All on Mon Sep 18 02:24:25 2023
    Buy ielts certificate online without exam

    Address: FL, USA

    WhatsApp: +1(210) 571-1426

    Email: info@englishproficiencyexams.com

    In today's competitive world, having an IELTS certificate can open up a world of opportunities for individuals looking to study or work abroad. However, preparing for and taking the IELTS exam can be a daunting task. What if there was an easier way to
    obtain this valuable certificate? In this article, we will explore the option to buy an IELTS certificate online without taking the exam.

    https://englishproficiencyexams.com/
    https://englishproficiencyexams.com/
    https://englishproficiencyexams.com/
    https://englishproficiencyexams.com/
    https://englishproficiencyexams.com/
    https://englishproficiencyexams.com/

    The International English Language Testing System (IELTS) is recognized worldwide as a reliable assessment of one's English language proficiency. Whether you are planning to study abroad, immigrate, or seek employment in an English-speaking country,
    having a valid IELTS certificate is often a mandatory requirement.

    The Traditional Path: Taking the IELTS Exam
    Traditionally, individuals looking to acquire an IELTS certificate would need to register for the exam, prepare rigorously, and then sit for the test. While this method is legitimate and widely accepted, it can be time-consuming and challenging.

    The legality of purchasing an IELTS certificate online varies by country and jurisdiction. We will explore the legal aspects and consequences of obtaining a certificate through non-traditional means.

    In conclusion, the decision to buy an IELTS certificate online without taking the exam is a complex one. It's essential to weigh the risks and legal implications carefully. Always remember that honesty and integrity should be the guiding principles in
    any endeavor.

    Address: FL, USA

    WhatsApp: +1(210) 571-1426

    Email: info@englishproficiencyexams.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)