pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    1. <legend id='R0srx'><style id='R0srx'><dir id='R0srx'><q id='R0srx'></q></dir></style></legend>
    2. <i id='R0srx'><tr id='R0srx'><dt id='R0srx'><q id='R0srx'><span id='R0srx'><b id='R0srx'><form id='R0srx'><ins id='R0srx'></ins><ul id='R0srx'></ul><sub id='R0srx'></sub></form><legend id='R0srx'></legend><bdo id='R0srx'><pre id='R0srx'><center id='R0srx'></center></pre></bdo></b><th id='R0srx'></th></span></q></dt></tr></i><div class="me0esku" id='R0srx'><tfoot id='R0srx'></tfoot><dl id='R0srx'><fieldset id='R0srx'></fieldset></dl></div>

      <small id='R0srx'></small><noframes id='R0srx'>

      1. <tfoot id='R0srx'></tfoot>
        • <bdo id='R0srx'></bdo><ul id='R0srx'></ul>

        極端分片:每個用戶一個 SQLite 數(shù)據(jù)庫

        Extreme Sharding: One SQLite Database Per User(極端分片:每個用戶一個 SQLite 數(shù)據(jù)庫)

        <legend id='jzmsn'><style id='jzmsn'><dir id='jzmsn'><q id='jzmsn'></q></dir></style></legend>
          <bdo id='jzmsn'></bdo><ul id='jzmsn'></ul>
          <i id='jzmsn'><tr id='jzmsn'><dt id='jzmsn'><q id='jzmsn'><span id='jzmsn'><b id='jzmsn'><form id='jzmsn'><ins id='jzmsn'></ins><ul id='jzmsn'></ul><sub id='jzmsn'></sub></form><legend id='jzmsn'></legend><bdo id='jzmsn'><pre id='jzmsn'><center id='jzmsn'></center></pre></bdo></b><th id='jzmsn'></th></span></q></dt></tr></i><div class="gsai0mw" id='jzmsn'><tfoot id='jzmsn'></tfoot><dl id='jzmsn'><fieldset id='jzmsn'></fieldset></dl></div>

              1. <tfoot id='jzmsn'></tfoot>

                <small id='jzmsn'></small><noframes id='jzmsn'>

                    <tbody id='jzmsn'></tbody>
                  本文介紹了極端分片:每個用戶一個 SQLite 數(shù)據(jù)庫的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在開發(fā)一個介于電子郵件服務(wù)和社交網(wǎng)絡(luò)之間的網(wǎng)絡(luò)應(yīng)用.我覺得它有潛力在未來變得非常大,所以我擔(dān)心可擴展性.

                  I'm working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I'm concerned about scalability.

                  我決定為每個活動用戶創(chuàng)建一個單獨的 SQLite 數(shù)據(jù)庫,而不是使用一個集中的 MySQL/InnoDB 數(shù)據(jù)庫,然后在那個時候?qū)ζ溥M行分區(qū):每個分片"一個活動用戶.

                  Instead of using one centralized MySQL/InnoDB database and then partitioning it when that time comes, I've decided to create a separate SQLite database for each active user: one active user per 'shard'.

                  這樣備份數(shù)據(jù)庫就像每天將每個用戶的數(shù)據(jù)庫文件復(fù)制到遠程位置一樣簡單.

                  That way backing up the database would be as easy as copying each user's small database file to a remote location once a day.

                  擴展就像添加額外的硬盤來存儲新文件一樣簡單.

                  Scaling up will be as easy as adding extra hard disks to store the new files.

                  當(dāng)應(yīng)用程序超出單個服務(wù)器時,我可以使用 GlusterFS 在文件系統(tǒng)級別將服務(wù)器鏈接在一起并原樣運行應(yīng)用程序,或者安裝一個簡單的 SQLite 代理系統(tǒng),允許每個服務(wù)器操作相鄰服務(wù)器中的 sqlite 文件.

                  When the app grows beyond a single server I can link the servers together at the filesystem level using GlusterFS and run the app unchanged, or rig up a simple SQLite proxy system that will allow each server to manipulate sqlite files in adjacent servers.

                  并發(fā)問題將最小化,因為每個 HTTP 請求一次只會訪問一個或兩個數(shù)據(jù)庫文件,在數(shù)千個中,而且 SQLite 無論如何只會阻止讀取.

                  Concurrency issues will be minimal because each HTTP request will only touch one or two database files at a time, out of thousands, and SQLite only blocks on reads anyway.

                  我敢打賭,這種方法將使我的應(yīng)用程序能夠優(yōu)雅地擴展并支持許多很酷和獨特的功能.我賭錯了嗎?我錯過了什么嗎?

                  I'm betting that this approach will allow my app to scale gracefully and support lots of cool and unique features. Am I betting wrong? Am I missing anything?

                  更新 我決定采用一個不太極端的解決方案,到目前為止它運行良好.我正在使用固定數(shù)量的分片 - 準(zhǔn)確地說是 256 個 sqlite 數(shù)據(jù)庫.每個用戶都通過一個簡單的哈希函數(shù)分配并綁定到一個隨機分片.

                  UPDATE I decided to go with a less extreme solution, which is working fine so far. I'm using a fixed number of shards - 256 sqlite databases, to be precise. Each user is assigned and bound to a random shard by a simple hash function.

                  我的應(yīng)用程序的大多數(shù)功能每個請求只需要訪問一兩個分片,但有一個特別需要對 256 個不同分片中的 10 到 100 個不同分片執(zhí)行簡單查詢,具體取決于用戶.測試表明,如果所有數(shù)據(jù)都緩存在 RAM 中,大約需要 0.02 秒或更短的時間.我想我可以忍受!

                  Most features of my app require access to just one or two shards per request, but there is one in particular that requires the execution of a simple query on 10 to 100 different shards out of 256, depending on the user. Tests indicate it would take about 0.02 seconds, or less, if all the data is cached in RAM. I think I can live with that!

                  UPDATE 2.0 我將應(yīng)用程序移植到 MySQL/InnoDB 并且能夠獲得與常規(guī)請求大致相同的性能,但是對于需要分片行走的請求,innodb 的速度提高了 4-5 倍.出于這個原因和其他原因,我放棄了這個架構(gòu),但我希望有人能在某個地方找到它的用處......謝謝.

                  UPDATE 2.0 I ported the app to MySQL/InnoDB and was able to get about the same performance for regular requests, but for that one request that requires shard walking, innodb is 4-5 times faster. For this reason, and other reason, I'm dropping this architecture, but I hope someone somewhere finds a use for it...thanks.

                  推薦答案

                  如果您必須執(zhí)行所謂的分片行走"——即找出一堆不同用戶的所有數(shù)據(jù),就會失敗.這種特定類型的查詢"必須以編程方式完成,依次詢問每個 SQLite 數(shù)據(jù)庫 - 并且很可能是您站點中最慢的方面.在將數(shù)據(jù)分片"到不同數(shù)據(jù)庫的任何系統(tǒng)中,這是一個常見問題.

                  The place where this will fail is if you have to do what's called "shard walking" - which is finding out all the data across a bunch of different users. That particular kind of "query" will have to be done programmatically, asking each of the SQLite databases in turn - and will very likely be the slowest aspect of your site. It's a common issue in any system where data has been "sharded" into separate databases.

                  如果所有數(shù)據(jù)對用戶來說都是獨立的,那么這應(yīng)該可以很好地擴展 - 使其成為有效設(shè)計的關(guān)鍵是了解數(shù)據(jù)可能會如何使用以及數(shù)據(jù)是否來自一個人將與來自另一個(在您的上下文中)的數(shù)據(jù)進行交互.

                  If all the of the data is self-contained to the user, then this should scale pretty well - the key to making this an effective design is to know how the data is likely going to be used and if data from one person will be interacting with data from another (in your context).

                  您可能還需要注意文件系統(tǒng)資源 - SQLite 很棒、很棒、速度很快等等 - 但是在使用標(biāo)準(zhǔn)數(shù)據(jù)庫"(即 MySQL、PostgreSQL 等)時確實可以獲得一些緩存和寫入優(yōu)勢,因為它們的設(shè)計方式.在您提議的設(shè)計中,您會錯過其中的一些內(nèi)容.

                  You may also need to watch out for file system resources - SQLite is great, awesome, fast, etc - but you do get some caching and writing benefits when using a "standard database" (i.e. MySQL, PostgreSQL, etc) because of how they're designed. In your proposed design, you'll be missing out on some of that.

                  這篇關(guān)于極端分片:每個用戶一個 SQLite 數(shù)據(jù)庫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Connect to SQLite in Apache Spark(在 Apache Spark 中連接到 SQLite)
                  NIFI - QueryDatabaseTable processor. How to query rows which is modified?(NIFI - QueryDatabaseTable 處理器.如何查詢被修改的行?)
                  Kafka JDBC source connector time stamp mode failing for sqlite3(Kafka JDBC 源連接器時間戳模式對 sqlite3 失敗)
                  Adobe Air: why SQLStatement#39;s getResult().data is null?(Adobe Air:為什么 SQLStatement 的 getResult().data 為空?)
                  SQLite and Flex(SQLite 和 Flex)
                  Adobe Air: convert sqlite#39;s result [object Object] to String?(Adobe Air:將 sqlite 的結(jié)果 [object Object] 轉(zhuǎn)換為 String?)
                  <tfoot id='Qkact'></tfoot>

                  • <i id='Qkact'><tr id='Qkact'><dt id='Qkact'><q id='Qkact'><span id='Qkact'><b id='Qkact'><form id='Qkact'><ins id='Qkact'></ins><ul id='Qkact'></ul><sub id='Qkact'></sub></form><legend id='Qkact'></legend><bdo id='Qkact'><pre id='Qkact'><center id='Qkact'></center></pre></bdo></b><th id='Qkact'></th></span></q></dt></tr></i><div class="memmuos" id='Qkact'><tfoot id='Qkact'></tfoot><dl id='Qkact'><fieldset id='Qkact'></fieldset></dl></div>
                        <tbody id='Qkact'></tbody>
                        • <bdo id='Qkact'></bdo><ul id='Qkact'></ul>
                          <legend id='Qkact'><style id='Qkact'><dir id='Qkact'><q id='Qkact'></q></dir></style></legend>

                            <small id='Qkact'></small><noframes id='Qkact'>

                            主站蜘蛛池模板: 超声波清洗机_细胞破碎仪_实验室超声仪器_恒温水浴-广东洁盟深那仪器 | 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 高效复合碳源-多核碳源生产厂家-污水处理反硝化菌种一长隆科技库巴鲁 | 深圳APP开发_手机软件APP定制外包_小程序开发公司-来科信 | 电机保护器-电动机综合保护器-浙江开民 | CE认证_FCC认证_CCC认证_MFI认证_UN38.3认证-微测检测 CNAS实验室 | 搪玻璃冷凝器_厂家-越宏化工设备 | 玻璃瓶厂家_酱菜瓶厂家_饮料瓶厂家_酒瓶厂家_玻璃杯厂家_徐州东明玻璃制品有限公司 | 活性氧化铝|无烟煤滤料|活性氧化铝厂家|锰砂滤料厂家-河南新泰净水材料有限公司 | 北京三友信电子科技有限公司-ETC高速自动栏杆机|ETC机柜|激光车辆轮廓测量仪|嵌入式车道控制器 | 无负压供水设备,消防稳压供水设备-淄博创辉供水设备有限公司 | 代办建筑资质升级-建筑资质延期就找上海国信启航 | 扬子叉车厂家_升降平台_电动搬运车|堆高车-扬子仓储叉车官网 | 苏州防水公司_厂房屋面外墙防水_地下室卫生间防水堵漏-苏州伊诺尔防水工程有限公司 | 广东成考网-广东成人高考网| 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 通信天线厂家_室分八木天线_对数周期天线_天线加工厂_林创天线源头厂家 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 上海乾拓贸易有限公司-日本SMC电磁阀_德国FESTO电磁阀_德国FESTO气缸 | 上海网站建设-上海网站制作-上海网站设计-上海做网站公司-咏熠软件 | 氢氧化钾厂家直销批发-济南金昊化工有限公司 | 求是网 - 思想建党 理论强党 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 123悬赏网_发布悬赏任务_广告任务平台| 防水套管|柔性防水套管|伸缩器|伸缩接头|传力接头-河南伟创管道 防水套管_柔性防水套管_刚性防水套管-巩义市润达管道设备制造有限公司 | 工业雾炮机_超细雾炮_远程抑尘射雾器-世纪润德环保设备 | 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 汕头市盛大文化传播有限公司,www.11400.cc | 北京公司注册_代理记账_代办商标注册工商执照-企力宝 | 洁净棚-洁净工作棚-无菌室-净化工程公司_北京卫护科技有限公司 | EDLC超级法拉电容器_LIC锂离子超级电容_超级电容模组_软包单体电容电池_轴向薄膜电力电容器_深圳佳名兴电容有限公司_JMX专注中高端品牌电容生产厂家 | 小小作文网_中小学优秀作文范文大全 | 骨密度仪-骨密度测定仪-超声骨密度仪-骨龄测定仪-天津开发区圣鸿医疗器械有限公司 | 无菌水质袋-NASCO食品无菌袋-Whirl-Pak无菌采样袋-深圳市慧普德贸易有限公司 | 照相馆预约系统,微信公众号摄影门店系统,影楼管理软件-盟百网络 | 江苏全风,高压风机,全风环保风机,全风环形高压风机,防爆高压风机厂家-江苏全风环保科技有限公司(官网) | 广州展台特装搭建商|特装展位设计搭建|展会特装搭建|特装展台制作设计|展览特装公司 | 辽宁资质代办_辽宁建筑资质办理_辽宁建筑资质延期升级_辽宁中杭资质代办 | 合肥网带炉_安徽箱式炉_钟罩炉-合肥品炙装备科技有限公司 | 制样机-密封锤式破碎机-粉碎机-智能马弗炉-南昌科鑫制样 | 高压包-点火器-高压发生器-点火变压器-江苏天网 |