投稿時間:2022-10-15 02:18:41 RSSフィード2022-10-15 02:00 分まとめ(24件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Government, Education, and Nonprofits Blog What US federal customers need to know about memorandum M-21-31 https://aws.amazon.com/blogs/publicsector/aws-federal-customers-memorandum-m-21-31/ What US federal customers need to know about memorandum M The US Office of Management and Budget published M a memorandum for federal government agencies to define event logging requirements related to cybersecurity incidents These guidelines aim to support the detection investigation and remediation of cyber incidents on federal information systems The memorandum defines various event logging EL tiers and the log data that must be captured for various log categories Learn the services from AWS that have been called out explicitly in the memorandum for logging and retention requirements at the EL level and the resources you can use to set up these services to capture the required log data 2022-10-14 16:23:59
Ruby Rubyタグが付けられた新着投稿 - Qiita HTMLの基礎知識(コメント機能で動画を投稿) https://qiita.com/tomo089/items/c0d7f67b6b33ccc77149 youtubecommentcontent 2022-10-15 01:42:10
Ruby Rubyタグが付けられた新着投稿 - Qiita 成果物を作る為の計画 https://qiita.com/rails3535/items/203568677ef6560e21fb 自問自答 2022-10-15 01:28:00
Docker dockerタグが付けられた新着投稿 - Qiita 成果物を作る為の計画 https://qiita.com/rails3535/items/203568677ef6560e21fb 自問自答 2022-10-15 01:28:00
Ruby Railsタグが付けられた新着投稿 - Qiita HTMLの基礎知識(コメント機能で動画を投稿) https://qiita.com/tomo089/items/c0d7f67b6b33ccc77149 youtubecommentcontent 2022-10-15 01:42:10
Ruby Railsタグが付けられた新着投稿 - Qiita 成果物を作る為の計画 https://qiita.com/rails3535/items/203568677ef6560e21fb 自問自答 2022-10-15 01:28:00
海外TECH Ars Technica Only PC players need a registered phone number for Modern Warfare 2 https://arstechnica.com/?p=1890131 drivers 2022-10-14 16:33:22
海外TECH Ars Technica How a Microsoft blunder opened millions of PCs to potent malware attacks https://arstechnica.com/?p=1889745 attacksmicrosoft 2022-10-14 16:26:54
海外TECH Ars Technica TikTok made money from getting Syrian refugees to beg in livestreams https://arstechnica.com/?p=1890110 tiktok 2022-10-14 16:22:02
海外TECH MakeUseOf How to Fix the Discord Game Detection Feature Not Working on Windows https://www.makeuseof.com/windows-discord-game-detection-not-working/ windows 2022-10-14 16:15:14
海外TECH DEV Community Elixir's DBConnection Pooling Deep Dive https://dev.to/debussyman/elixirs-dbconnection-pooling-deep-dive-273l Elixir x s DBConnection Pooling Deep DiveDBConnection ConnectionError connection not available and request was dropped from queue after ms This means requests are coming in and your connection pool cannot serve them fast enough You can address this by By tracking down slow queries and making sure they are running fast enough Increasing the pool size albeit it increases resource consumption Allow requests to wait longer by increasing queue target and queue intervalSee DBConnection start link for more informationIt is pretty common to run unto this error as an Elixir developer working with relational databases The suggested fixes definitely help but personally I feel bad tweaking something I don t understand How does changing pool size actually affect the rest of the application I want to keep my mysteries to Saturday morning cartoons not production So I decided to dig in and see how pooling works DBConnection is a foundation Elixir library powering many database specific adapters Most of the time you don t need to know much about it since the adapter libraries abstract away most of its inner workings While looking into some performance issues my team realized we didn t have a shared mental modal of how pooling works with DBConnection It is largely undocumented and a quick glance at the code wasn t enough to let us know how it worked So like any rational engineer I went way too deep in the code and traced through everything that was happening for pooled database connections This writeup uses Postgrex as the example adapter but nothing about the explanation is specific to PostgreSQL The pooling works exactly the same for any other library using DBConnection If you want to try the code snippets yourself check out the Livebook version of this post Database setupFirst comes the easy part We ll start a database connection using a minimal set of options To run the code below you ll need postgres running locally Setup a database connectiondb opts database postgres hostname localhost password postgres pool size port username postgres ok conn Postgrex start link db opts What just happened In the configuration code above a process is created and returned to the caller A ton of work happened in the DBConnection library as a result let s dive into it First Postgrex start link calls DBConnection start link def start link opts do ensure deps started opts opts Postgrex Utils default opts opts DBConnection start link Postgrex Protocol opts endThe child spec returned by DBConnection is polymorphic It looks for a pool module specified in the opts and returns the result of that module s child spec function For the default DBConnection ConnectionPool module this is just a wrapper around GenServer child spec which specifies to call start link with the parameter Postgrex Protocol opts So the process created and returned by Postgrex start link will be a DBConnection ConnectionPool GenServer Done No not done DBConnection ConnectionPool init creates a protected ETS table to handle queueing of queries The table identifier is kept in the process s state so we can look it up and read from it The process also keeps track of whether it is busy or ready initially starting as busy More on that later ConnectionPool state Get the ETS identifier from the process state tag queue codel timestamp sys get state conn busy Reference lt gt delay idle Reference lt gt idle interval interval next poll Reference lt gt slow false target Process treeWhen the db connection application is first started DBConnection ConnectionPool Supervisor is run as a dynamic supervisor This happens automatically when db connection is included as a mix dependency ConnectionPool setupThe DBConnection ConnectionPool process does a few things when it is initializing Mostly it sets up timers for things like idle timeouts It also calls DBConnection ConnectionPool Pool start supervised with the ETS queue it created def init mod opts do DBConnection register as pool mod queue ets new MODULE Queue protected ordered set ts System monotonic time ok DBConnection ConnectionPool Pool start supervised queue mod opts snip endThis causes the DBConnection Watcher GenServer process running under the application supervision tree to create a DBConnection ConnectionPool Pool process as a dynamically supervised child of DBConnection ConnectionPool Supervisor Side note normally the new process would be only be linked to its parent supervisor but DBConnection Watcher will monitor the calling DBConnection ConnectionPool process and terminate the new process when the calling process stops This effectively links the two processes together DBConnection ConnectionPool Pool is itself another supervisor When its init function is called the pool size option is checked with a default of This parameter is passed all the way down from the original Postgrex start link call and determines how many children the supervisor will have def init owner tag mod opts do size Keyword get opts pool size children for id lt size do conn owner tag id mod opts sup opts strategy one for one Keyword take opts max restarts max seconds Supervisor init children sup opts endEach child in the pool is a DBConnection Connection which is an implementation of the Connection behaviour The adapter can specify callbacks to run after the connection is established if it chooses to Connection state pool sup supervisor DynamicSupervisor which children DBConnection ConnectionPool Supervisor pool conn worker Supervisor which children pool sup Connection mod state state sys get state pool conn state after connect nil after connect timeout backoff DBConnection Backoff max min state type rand exp client Reference lt gt pool connection listeners mod Postgrex Protocol opts pool index types Postgrex DefaultTypes database postgres hostname localhost password postgres pool size port username postgres pool PID lt gt state Postgrex Protocol buffer connection id connection key disconnect on error codes null nil parameters Reference lt gt peer ping timeout postgres idle queries Reference lt gt sock gen tcp Port lt gt timeout transactions naive types Postgrex DefaultTypes Reference lt gt tag Reference lt gt timer nil Each Connection process keeps track of several things in its state The pool key contains the PID of the DBConnection ConnectionPool process the one that was returned from Postgrex start link The tag key contains the table identifier for the ETS table used as a queue Most of the state is generic but the nested state key is specific to the calling library Postgrex in this case Adding the connection to the poolAfter the connection is established DBConnection Holder update is called This creates a new public ETS table and gives ownership of it to the DBConnection ConnectionPool process def update pool ref mod state do holder new pool ref mod state try do ets give away holder pool checkin ref System monotonic time ok holder rescue ArgumentError gt error endendWhen the ownership message is received the ConnectionPool process will check its queue and try to pull off the first message Since the queue starts empty this is a noop and the pool will just transition from busy to ready An entry of timestamp holder is inserted into the queue where holder is a reference to the ETS table created by DBConnection Holder When the process is in its ready state the ETS queue will always contain either this holder tuple or nothing When the process is busy the queue will instead have queries waiting for an available connection A single entry exists in the queue that contains a reference to the holder ETS ets match queue Reference lt gt Pool sizeSo what happens if we change the pool size Extra DBConnection Connection processes are spawned under theDBConnection ConnectionPool Pool supervisor They all share the same ETS queue and reference the same DBConnection ConnectionPool process ok conn db opts gt Keyword put pool size gt Postgrex start link ConnectionPool Supervisor children one for each start link callSupervisor count children DBConnection ConnectionPool Supervisor active specs supervisors workers pool sup supervisor DynamicSupervisor which children DBConnection ConnectionPool Supervisor ConnectionPool Pool children one for each pooled connectionSupervisor count children pool sup active specs supervisors workers The holder ETS pattern is repeated for each underlying connection in the pool The single DBConnection ConnectionPool process that is returned by start link contains a single queue and for each pooled connection an entry in the queue is inserted with holder ETS table that references a single underlying connection View the queue with two pooled connections tag queue codel timestamp sys get state conn ets match queue Reference lt gt Reference lt gt Queueing and queryingNow that we understand the processes the remaining question is how queries get queued and sent to the underlying connections Postgrex query takes our PID as its first argument That gets passed to DBConnection prepare execute I ll spare you the full stacktrace but eventually DBConnection Holder checkout call is called This function sends a message to the DBConnection ConnectionPool process asking to checkout a connection One of the parameters sent is whether queueing is allowed which is controlled by the queue parameter and defaults to true If the DBConnection ConnectionPool process is in a busy state then the request is either inserted into the ETS queue or rejected depending on the queue parameter Assuming the process is ready the first holder tuple is deleted from the queue and ownership of that holder ETS reference is given away to the calling process If no more holder entries are available the process is marked as busy DBConnection Holder waits for the message from the ETS ownership transfer within the calling process It marks the connection contained within the holder ETS entry as locked and returns the connection receive do ETS TRANSFER holder pool lock ref checkin time gt Process demonitor lock flush deadline ops start deadline timeout pool ref holder start ets update element holder conn conn lock lock ops pool ref pool ref pool pool reference ref deadline deadline holder holder lock lock checkout result holder pool ref checkin time snip endThe connection is now checked out and used by DBConnection to make the query Once the query is complete Holder checkin is called with the connection The holder ETS table is updated and ownership is transferred back to the DBConnection ConnectionPool process If the process was busy which indicates that all connections were checkout out then the queue is checked for any waiting queries and the steps repeat SummaryLet s summarize what we learned When start link is called A DBConnection ConnectionPool process is started This is pretty much the only thing the user interacts with directly An ETS table is created by the ConnectionPool and used as queue for incoming requests as well as tracking connections in the pool A DBConnection ConnectionPool Pool supervisor is started This is dynamically added to the DBConnection s supervision tree and DBConnection Watcher links it to the ConnectionPool process One or more DBConnection Connection processes are started as children of the Pool supervisor Each one represents a separate network connection to the database Each Connection is referenced by an ETS table created by DBConnection Holder Ownership of these holder tables is passed to the ConnectionPool process  And finally when a query is sent The first available connection is found by looking at the ETS queue for a holder reference The calling process gets ownership of the holder ETS table and the reference to it is removed from the queue If no holders are found the query is added to the ETS queue When a query finishes the holder reference is passed back to the ConnectionPool process The next queued query is pulled and run if there are any postgrex start link db connection pool module supervision tree start pool process pool process definition connection start link pool update  ConnectionPool checkin Postgrex query Holder checkout call 2022-10-14 16:32:08
Apple AppleInsider - Frontpage News Deals: save $140 on Apple's MacBook Air M2 (16GB RAM, 512GB SSD) with AppleCare https://appleinsider.com/articles/22/10/14/deals-save-140-on-apples-macbook-air-m2-16gb-ram-512gb-ssd-with-applecare?utm_medium=rss Deals save on Apple x s MacBook Air M GB RAM GB SSD with AppleCareSave on the upgraded MacBook Air itself plus another on AppleCare with our exclusive promo code Save on Apple s MacBook Air M with AppleCare The upgraded MacBook Air configuration features the line s M chip with a core GPU instead of the standard core version It also has GB of memory and GB of storage double that found in the standard model making it a robust configuration that won t break the bank Read more 2022-10-14 16:45:07
Apple AppleInsider - Frontpage News Mophie's new powerstation plus will charge three devices, simultaneously https://appleinsider.com/articles/22/10/14/mophies-new-powerstation-plus-will-charge-three-devices-simultaneously?utm_medium=rss Mophie x s new powerstation plus will charge three devices simultaneouslyMophie s new powerstation plus is a portable battery bank incorporating two types of built in cables for Apple devices and a third USB C port mophie powerstation plusThe powerstation plus has both a built in Lightning and a USB C cable to charge iPad iPhone and USB C accessories It s a convenient way to charge multiple devices using just one power bank Read more 2022-10-14 16:01:40
海外TECH CodeProject Latest Articles Asynchronous Multicast Delegates in C++ https://www.codeproject.com/Articles/1160934/Asynchronous-Multicast-Delegates-in-Cplusplus callable 2022-10-14 16:55:00
金融 RSS FILE - 日本証券業協会 株主コミュニティ銘柄 https://market.jsda.or.jp/shijyo/kabucommunity/seido/meigara/20200907180856.html 株主コミュニティ 2022-10-14 16:56:00
金融 金融庁ホームページ 金融安定理事会によるG20財務大臣・中央銀行総裁への レターの公表について掲載しました。 https://www.fsa.go.jp/inter/fsf/20221014/20221014.html 中央銀行 2022-10-14 17:00:00
ニュース BBC News - Home This is difficult, PM admits on day of sacking chancellor https://www.bbc.co.uk/news/uk-politics-63261432?at_medium=RSS&at_campaign=KARANGA economic 2022-10-14 16:20:17
ニュース BBC News - Home Actor Robbie Coltrane dies aged 72 https://www.bbc.co.uk/news/entertainment-arts-63261204?at_medium=RSS&at_campaign=KARANGA harry 2022-10-14 16:51:24
ニュース BBC News - Home Van Gogh's Sunflowers back on display after oil protesters threw soup on it https://www.bbc.co.uk/news/entertainment-arts-63254878?at_medium=RSS&at_campaign=KARANGA tomato 2022-10-14 16:31:32
ニュース BBC News - Home Who is Jeremy Hunt? New UK chancellor who backed Sunak in leadership race https://www.bbc.co.uk/news/uk-politics-63259600?at_medium=RSS&at_campaign=KARANGA crucial 2022-10-14 16:14:44
ニュース BBC News - Home Government borrowing costs rise after PM's U-turn https://www.bbc.co.uk/news/business-63243918?at_medium=RSS&at_campaign=KARANGA corporation 2022-10-14 16:53:55
北海道 北海道新聞 大阪でだんじり横転、1人死亡 秋祭り中、ほかに3人搬送 https://www.hokkaido-np.co.jp/article/745722/ 富田林市消防本部 2022-10-15 01:15:00
北海道 北海道新聞 オスプレイ飛行、通算9日間 道内の日米共同訓練終了 https://www.hokkaido-np.co.jp/article/745721/ 米海兵隊 2022-10-15 01:12:00
北海道 北海道新聞 札幌・もみじ台団地で出火 女性1人死亡 https://www.hokkaido-np.co.jp/article/745719/ 市営住宅 2022-10-15 01:01:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)