TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #425 · 20 апр.

Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках. Выглядело это примерно так: from fastapi.concurrency import run_in_threadpool async def execute(data: DataRequest) -> DataResponse: try: result = await run_in_threadpool(sync_function, data) return DataResponse(data=result) except Exception as e: return DataResponse( error=str(e), success=False, ) В общем работает нормально. Для всех вызовов под капотом используется общий тредпул, всё работает предсказуемо. Но потребовалось изменить количество запускаемых в пуле потоков (по умолчанию создается 40 воркеров). Так как дело происходит с FastAPI, делается это через lifespan используя настройки anyio: import anyio @asynccontextmanager async def lifespan(app: FastAPI): limiter = anyio.to_thread.current_default_thread_limiter() limiter.total_tokens = 100 yield # если вдруг нужно вернуть обратно limiter.total_tokens = 40 Зачем менять количество воркеров? - уменьшить, если оперативки мало (один тред занимает ~8мб) - увеличить чтобы выдержать нагрузку Если есть предложения получше при тех же вводных - предлагайте😉 #async

Hashtags

Резултати

Пронајдени 8 слични објави

Пребарај: #millennials

当前筛选 #millennials清除筛选
🦅 [ perspective ix ]

@perspectiveix · Post #1666 · 19.11.2018 г., 10:48

📺Video Works! Video marketing has been growing in popularity in recent times, and new statistics from a Brightcove study provide some reasons why that’s the case. Fully three-quarters (76%) of the almost 4,500 adults surveyed in the US, UK and Australia report having made a purchase after viewing a marketing video. The Brightcove report indicates that video holds even greater appeal among #Millennials, as 85% of 18-34-year-olds said they’d made a purchase after watching a marketing video. 🚀@PerspectiveIX via MarketingCharts.

Hashtags

🦅 [ perspective ix ]

@perspectiveix · Post #1645 · 08.11.2018 г., 10:00

🤝Trust in Brands & Influencers UK #Millennials are still more likely to follow recommendations from #SocialMedia influencers than the over 35s category, with 21% swayed by celebrity endorsements – compared to just 4% of over 35s. 🚀@PerspectiveIX - by SurveyMonkey via TheDrum. ❓Would celebrity endorsement influence your decision?

🦅 [ perspective ix ]

@perspectiveix · Post #1372 · 30.06.2018 г., 19:30

​​📱Facebook vs. Snapchat Which one is the most popular among Millennials? ❗️ Social Media Savvy #Millennials: the top 20% of all Millennial #SocialMedia and communications users (in the U.S., ages 18-35), based on the amount of time they spend per month with social media and communication brands. Stickiness is how Verto measures user engagement with a particular digital property, by comparing daily users to monthly users. Our analysis of the stickiest social media and communications brands among Social Media Savvy Millennials shows which social media platforms this subset of Millennials use on a regular (even daily) basis. Among Social Media Savvy Millennials, the stickiest social media platforms are still dominated by Facebook-owned properties: Facebook (90% stickiness rating) and Facebook Messenger (61% stickiness rating). And while Snapchat earns a 60% stickiness rating, its user numbers still lag well behind those of Instagram (55% stickiness rating). 🚀@PerspectiveIX ☕️prs.pctvix.co/2M8AAOb

🦅 [ perspective ix ]

@perspectiveix · Post #1271 · 15.05.2018 г., 19:30

​​📣The Power of Recommendations on Social Media Brand discovery is where peer-to-peer recommendations on #SocialMedia have the most impact – as much as 27% of #Millennials cite this as a way of discovering new brands. 🚀@PerspectiveIX Read more at https://prs.pctvix.co/2wH6rlb

🦅 [ perspective ix ]

@perspectiveix · Post #1580 · 03.10.2018 г., 08:00

​​📺Who’s Watching the Ads on YouTube? This week, #YouTube announced a new type of in-stream ad format, positioned as a new way for “advertisers to connect with their audience” by allowing viewers to move beyond mere click-through interactions and onto more complex transactions, like downloading an app or buying a movie ticket. According to Verto data gathered over the past year, men and Millennials spend the most time watching ads on YouTube’s mobile app. Men spend an average of 6 minutes per month watching ads on the app, compared to just under 4 minutes per month among women (and an average of just under 5 minutes per month for all users). Younger #Millennials (18-24) rack up an average of 9 minutes per month watching ads on the YouTube mobile app, which is nearly double the amount of time that older Millennials (25-34) spend with ads on the YouTube app. 🚀@PerspectiveIX via VertoAnalytics. 💌 Join Pulse Weekly ❓Have you watched a video on YouTube during last 7 days?

🦅 [ perspective ix ]

@perspectiveix · Post #1615 · 21.10.2018 г., 09:00

​​⚡️Generation Z & Their Love for Aesthetic Boards #GenZ is often referred to as one of the most unique, values-driven generations. They see identity as fluid and care about social impact, with 56% considering themselves socially conscious, according to #Pinterest. There are over 37 million aesthetic related boards on Pinterest, with Gen Z’ers searching for “aesthetic” 447% more than #Millennials. Through aesthetic boards like witch, grunge and love, Gen Z is finding their identity. - Witch Aesthetic +281%, 3.1X more than millennials - Grunge Aesthetic +262%, 6.3X more than millennials - Love Aesthetic +351%, 2.6X more than millennials - Art Aesthetic +353%, searching 3.3X more than millennials - Writing Aesthetic +241%, searching 7.0X more than millennials As Gen Z curates these boards to find their inner selves, they provide a unique look into emerging subcultures and passions. ❗️Generation Z or Gen Z, also known by a number of other names, is the demographic cohort after the Millennials. There are no precise dates for when this cohort starts or ends, but demographers and researchers typically use the mid-1990s to mid-2000s as starting birth years. There is little consensus regarding ending birth years. 🚀@PerspectiveIX via Pinterest . ❓When were you born?

🦅 [ perspective ix ]

@perspectiveix · Post #1502 · 27.08.2018 г., 08:00

​​🤳The Story of Stories According to a VidMob survey conducted among a thousand 16-24-year-olds in the US, #Snapchat (73%) edges #Instagram (70%) for consumption of Stories. However, the gap in #GenZ's content creation for Stories is a lot bigger on these platforms where Snapchat (58%) is way ahead of Instagram (39%). For #Millennials, however, the story is a bit different. According to the accompanying survey of a thousand 25-34-year-olds, they seem to prefer Instagram (58%) instead of Snapchat (53%) for story consumption. But just like their younger counterparts, Snapchat (34%) is their platform of choice when it comes to creating stories compared to Instagram (31%) or #Facebook (20%). 🚀@PerspectiveIX via MarketingCharts: prs.pctvix.co/2MTD6e9 ❓Where do YOU WATCH Stories?