본문 바로가기

728x90
반응형

전체 글

(263)
FastAPI + SQLAlchemy: DB Connection이 지속적으로 생기는 문제 FastAPI는 일반적으로 SQLAlchemy와 함께 사용하며,다수의 커넥션풀을 유지하기 위해서 QueuePool을 사용한다.(비동기 데이터베이스 라이브러리 사용시에는 QueuePool이 아닌 async에 맞는 풀 사용)# database.pyfrom sqlalchemy import create_enginefrom sqlalchemy.pool import QueuePoolfrom sqlalchemy.orm import sessionmakersync_engine = create_engine( SYNC_DATABASE_URL, poolclass=QueuePool, pool_size=20, max_overflow=5, pool_timeout=30, pool_recycle=360..
aiohttp: async requests code example install: pip install aiohttp  다수의 request를 비동기적으로 요청하기 (예제에서는 1000번) - put 요청 기준 - post도 동일한 방식 (메소드만 put -> post 변경) import aiohttpimport asyncioasync def send_put_request(session, url, data, headers): async with session.put(url, json=data, headers=headers) as response: return response.status, await response.text()async def main(url, data, headers): async with aiohttp.ClientSession..
MySQL: max_connections 수정 Check current max_connections:SHOW VARIABLES LIKE 'max_connections'; Changing the maximum number of connections that MySQL can handle involves modifying the max_connections setting. This parameter determines how many concurrent connections MySQL can accept. Here’s how you can adjust this setting, either temporarily or permanently:Temporarily Changing Max Connections1. Via MySQL Command Line:Conn..
FastAPI + SQLAlchemy: connection pool log 찍기 # Pool 커스텀 https://github.com/Junanjunan/g6/commit/709b910470c6c216f5e7d5870f1403095b7ef44e 로그 생성용 커스텀 커넥션 풀 설정 · Junanjunan/g6@709b910Junanjunan committed May 3, 2024github.com
C: #ifndef / likely(x) / unlikely(x) / __builtin_expect(!!(x), 1) #if (CONFIG_COMPILER_OPTIMIZATION_PERF)#ifndef likely#define likely(x) __builtin_expect(!!(x), 1)#endif#ifndef unlikely#define unlikely(x) __builtin_expect(!!(x), 0)#endif#else#ifndef likely#define likely(x) (x)#endif#ifndef unlikely#define unlikely(x) (x)#endif#endif/** * Macro which can be used to check the condition. If the condition is not 'true', it prints the message * and ..
ESP-IDF: idf.py --ccache build ccache가 설치되어 있는 경우 build 속도가 상당히 빨라진다고 해서 테스트를 해보았다.블루투스 example들을 build 하는 경우 정말 빌드할 것이 많아서 자잘한 수정을 하고 빌드를 하는 경우 꽤 성가시다. 공식 홈페이지에는 윈도우나 리눅스나 알집 형태로 받도록 되어 있다.https://c..
Bluetooth - HID: Little Endian, Big Endian 참고 블로그:https://zion830.tistory.com/38https://softtone-someday.tistory.com/20<a href="https://techz..
C: function pointer ESP-IDF의 예시코드typedef void (*esp_hidd_event_cb_t) (esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param); function pointer  - 함수의 주소를 가리키는 포인터  - callback, event driven 함수에서 유용하게 사용 가능  Function pointers in C are a powerful feature that allow you to store the address of a function in a variable, and use that variable to call the function. This can be very useful for implementing callback..

728x90
반응형