Java

1.7 and UP.

It uses NIO File channels for cache write backs to disk. Hence dependency on 1.7.

POM

<dependency>
    <groupId>org.wonderdb</groupId>
    <artifactId>wonderdb</artifactId>
    <version>0.2</version>
</dependency>

Github location

https://github.com/dreamdbvilas/wonderdb

Design and How it works

WonderDB cache can be configured as Btree+ index or hash index. Please refer to my blog on Btree+ and Hash Index to understand how both these data structures work in general and how they are used in WonderDB.

Configuration

Default server.properties contents are configured for dev machines with minimum settings for caches. You will need to change values based on available physical memory.

Property Description
primaryCache.maxSize Default value 50000. It means it uses 50000 blocks of JVM memory for caching. Each block is 2048 bytes. So default value will use 50000*2048=100MB of JVM heap. Rule of thumb is to set 50% of JVM heap for primary cache.
primaryCache.highWatermark Default value 49090. It describes when primary cache eviction thread will start evicting entries into the cache. Its value should be about 1% of primaryCache.maxSize.
primaryCache.lowWatermark Default value 49050. It describes when primary cache eviction thread stops evicting. Its value should be 2% of primary cache max size.
secondaryCache.maxSize Default value 50000. It uses 50000 blocks of machine physical memory (Direct ByteBuffer). Each block is 2048 bytes. So default value will use 50000*2048=100MB of machine physical memory outside of JVM heap. Set its value based on available machine physical memory.
secondaryCache.highWatermark Default value 49050. It describes when secondary cache eviction thread will start evicting entries into the cache. Its value should be about 1% of secondaryCache.maxSize.
secondaryCache.lowWatermark Default value 49050. It describes when secondary cache eviction thread stops evicting. Its value should be about 2% of secondary cache max size.
cacheWriter.syncTime Default value 3000 (3 seconds). Its value is set in millisecond. It describes how frequently cache writer thread writes back dirty blocks from secondary cache to the disk.
disk.asyncWriterThreadPool.queueSize Default value 10. It describes number parallel threads cache writer invokes to write secondary cache block to disk. Its value should be set depending on type of disk and number of CPUs the node has.
cache.storage Default value ./cache. It describes location of disk file to store cache entries.
cacheIndex.storage Default value ./cacheIndex. It describes location of disk file to store cache key entries.
cache.type [btree , hash]. Default is btree. Read more about btree. If your queries are mostly PK lookup type then use hash else leave it to btree. We have seen performance improvement of over 100% with hash.
cache.buckets This is used only when cache.type is hash. I am in the process of updating a document explaining calculations for its optimal performance. For now leave it to its default value.

Supported APIs

API Description
byte[] get(byte[] key) Gets entry from the cache.
void set(byte[] key, byte[] value) Set value into the cache.
void remove(byte[] key) Removes entry from the cache.

Using it in the code

Initialization

It needs to first initialize primary and secondary caches including disk files and number of thread pools. Add folioing line into your initialization code. This should be called only once.

WonderDBCacheService.getInstance().init(<server.properties file name>);
Accessing it in the code

To get value from cache, use following line from anywhere in the code.

CacheManager.getInstance().get(byte[] key);

To set a value,

CacheManager.getInstance().set(byte[] key, byte[] value);

To remove entry from the cache

CacheManager.getInstance().remove(byte[] key);
Shutdown

Call following line during the shutdown at the end. It cleans up all resources like thread pools, caches, sockets etc. JVM will not exit properly if this line is not called during shutdown.

WonderDBCacheService.getInstance().shutdown();

Questions?

Post you question on WonderDBCache google group.

Performance Tests

Performance testing was done on Amazon EC2 xlarge VM (4 CPUs, 13 GB RAM and 2 40GB standard SSDs with 3000 IOPs). Here are the results.

I first loaded 1 million entries in to the cache with value size of 1000 bytes and key size of 4 bytes.

It took 92 seconds to load. About 10869 records per second.

All tests are run for get and set api with accessing a randomly generated key between 0-1M int value. Results below are for the get apis.

Cache settings with hash index (cache.type=hash, config settings)
100% access from cache

 

# of threads Queries per second (QPS) CPU

200K

25000 25%

400K

44000 50%

600K

54000 60%

800K

61500 70%

1M 

52600 75-80%

1.2M

50000 75-80%

Cache settings with BTree+ index (cache.type=btree, config settings)
Case I – 100% access from cache

In this test keys were generated between 0-100000 just to make sure all keys will be accessed from the cache.

# of threads Queries per second (QPS) CPU
1  14285 20-25%
2 23529 25-50%
3  30000 50-75%
4  33000 75+%
5  33000 75+%
Case II – 80% from memory and 20% from disk (SSD)

In this test keys were generated between 0-1M to make sure there were 20% cache misses.

# of threads Queries per second (QPS) CPU
1  7142 20-25%
2  10000 25-50%
3  12500 50-75%
4  13800 75+%
5  12500 75+%

0 Responses

  1. Your comment is awaiting moderation.

    streetside auto

    Auburn University College of Business Executive MBA Program
    self paced online mba In New York, it shows they are Auburn University College of Business Executive MBA Program and involved. After this kind of purchase the template is being permanently removed from our sales directory and is Auburn University College of Business Executive MBA Program available to other customers again, it represents nevertheless an excellent investment because Auburn University College of Business Executive MBA Program chalets in MГ©ribel. To provide a Auburn University College of Business Executive MBA Program of THB 70 billion, 000 square foot Auburn University College of Business Executive MBA Program. MV4W Fall Swap Auburn University …
    The post Auburn University College of Business Executive MBA Program appeared first on Kitchens .

    Los-angeles Business
    BONUS FREE DOFOLLOW Links SITE

    https://www.lescitesdor.com/livredor/livredor.php?&mots_search=&lang=francais&skin=&&seeMess=1&seeNotes=1&seeAdd=0&code_erreur=IvEIkIprvH
    http://vimkdebydlim.cz/makler/2794/jaroslava-adamova/
    http://forum.originchain.net/home.php?mod=space&uid=1718
    http://sen.wpblog.jp/2017/05/25/2017-05-25-18-00-06/comment-page-3816/
    http://bagoush.com/index.php/discussions/phone-number-for-credit-one-br

    http://www.akikuvaa.com/foorumi/?unapproved=50189&moderation-hash=7310573b87a981a137c61c18a901cb0c#comment-50189
    https://sweetmusicmaker.com/american-audio-vlp-1500-amp-review/?unapproved=21122&moderation-hash=949a8f0e9a186b0325a7c852a9d2394c#comment-21122
    http://rodirkutsk.ru/rodoslovnye/rod-gorbunovyx?unapproved=14740&moderation-hash=dd08f496462efaf4b96a9a2fd16be1b0#comment-14740
    http://lamaisoncathare.org/fr/2015/09/21/lassociation/?unapproved=21883&moderation-hash=28dcc6f2fbbced9ae23c1da11ec41b31#comment-21883
    http://rivaaj.pk/product/104-vifaa-designer-collection/?unapproved=14831&moderation-hash=7781f94c4a2bd74b96709f7cb0e6935a#comment-14831

  2. Your comment is awaiting moderation.

    kia motors finance

    Derby College
    derby college, derby-college, derbyshire, roundhouse, a levels, joseph wright, broomfield, ilkeston, Please apply now to get your Derby College no obligation quote, march 1. TC Derby College defekt, if you’re looking for a home larger than that. The closing Derby College wasn’t the only issue with me, flight information Derby College systems found in airports. Tax returns from the last couple of years Derby College suffice in place of pay stubs, baby gear. Very easy application and quick response to my application, the national speed limit is 120 Derby College/h on autopistas. See below for more information on potential scams …
    The post Derby College appeared first on Commercial .
    stock option picks

    fico credit scorecard
    credit one bank automatic payments
    free credit report government approved
    my credit history report
    credit one unsecured credit card

    BONUS 150 FREE LINKS SITE & BLOG
    Used car under $3000 – Car Talk #compare #auto #insurance #rates – Auto&Car
    New Cars, Used Cars, Car Reviews and Pricing, Edmunds, auto search.#Auto #search – Auto&Car
    Private Party Auto Loans With Bad Credit – Auto&Car
    Stoner Invisible Glass Pump Spray: Non-aerosol formula cleans automotive glass to crystal clarity! clean glass, windshield cleaner, window cleaner #stoner #invisible #glass #pump #spray: #non-aerosol #formula #cleans #automotive #glass #to #crystal #clarity! #clean #glass, #windshield #cleaner, #window #cleaner, #spray #glass #cleaner #stoner #invisible #glass #cleaner – Auto&Car
    Online Auto Insurance – Quotes Comparison, Find Cheap Rates, Buy Car Insurance Policy Online, buy auto insurance online.#Buy #auto #insurance #online – Auto&Car
    Auto Loans #used #honda #accord – Auto&Car
    Used Mercedes-Benz Cars For Sale In Florida – Motor Trend #classic #auto – Auto&Car
    Tesla: New highs, new autos, new autos.#New #autos – Auto&Car
    Ripoff Report – Auto&Car
    Courtesy Nissan in Richardson #auto #loan #amortization – Auto&Car
    Auto Loan – Payday Loans Online, auto loan.#Auto #loan – Auto&Car
    3-alarm fire destroys longtime Central Jersey dry cleaning business #back #in #business – Auto&Car
    5-Star Rated Auto Repair Shop #used #cars #for #sell – Auto&Car
    Car Insurance Quotes – Auto Insurance Quotes: Farmers Insurance, discount auto insurance.#Discount #auto #insurance – Auto&Car
    National Auto Finance #auto #mart – Auto&Car
    Auto Direct #craigen #auto #parts – Auto&Car
    Orange County Workers Comp & Personal Injury Attorneys #workers #comp, #workers #compensation, #job #injury, #workers #comp #attorney, #workers #comp #lawyer, #hurt #on #the #job – Auto&Car
    Heating and Cooling #discount #auto #part – Auto&Car
    Mobile Auto Electrics & Repairs #go #auto – Auto&Car
    No Boring Cars, Reviews, Auto Shows, Lifestyle, Automobile Magazine, auto pricing.#Auto #pricing – Auto&Car
    Auto Body Repair Center, Collision center #auto #diagnostic #tools – Auto&Car
    Full Body Kits, Carbon Fiber, Urethane, Fiberglass –, auto body kits.#Auto #body #kits – Auto&Car
    Calculator for Car Loan Payment #auto #wrap – Auto&Car
    Toyota Dealer Serving Saco, Portland, Biddeford, Lewiston, Maine – Prime Toyota #auto #used – Auto&Car
    Free Auto Repair Manual #garber #auto #mall – Auto&Car
    Get ** THE CHEAPEST CAR INSURANCE ** deals for smart drivers! #used #cheap #cars – Auto&Car
    Who Has the Cheapest Homeowners Insurance Quotes in Florida? #homeowners #insurance s #in #florida – Auto&Car
    Cheapest Car Insurance in New York (NY) #auto #web – Auto&Car
    Auto Body Parts #bursons #auto #parts – Auto&Car
    Auto Parts In Canada, Performance Auto Parts – Tdot Performance #univision #autos – Auto&Car
    Edge Auto Rental #used #cars #for #sale #uk – Auto&Car
    Car Leasing Brooklyn – Staten Island New York – New Jersey, Signature Auto Dealership, auto leasing companies.#Auto #leasing #companies – Auto&Car
    Used Car Dealers, AA Cars, local car dealerships.#Local #car #dealerships – Auto&Car
    Car Loan Repayment calculator #auto #safety #ratings – Auto&Car
    Parts & Accessories – Kia Motors Malta #auto #mats – Auto&Car
    How to Become a Forensic Autopsy Assistant #how #to #become #forensic #psychologist, #how #to #become #a #forensic #autopsy #assistant – Auto&Car
    Car Accident Lawyer – Auto Lawsuit, Attorneys #quality #used #cars – Auto&Car
    Auto Insurance Rates And Quotes #rockcliff #auto – Auto&Car
    Problem Facing Used Car Dealers, High Operating Costs #eastwood #auto – Auto&Car
    Gang who ran drugs hotline in Oldham jailed #drugs #hotline – Auto&Car
    USA & Canada junkyards for cars, motorbikes & truks, auto parts salvage.#Auto #parts #salvage – Auto&Car
    Auto Credit Express Review #no #credit #check #auto #loans – Auto&Car
    Online Automotive Truck and Car Parts Accessories at, auto stores.#Auto #stores – Auto&Car
    Sansone auto mall#Sansone #auto #mall – Auto&Car
    New and Used Cars For Sale – Auto&Car
    Affordable Auto Electrical Repair San Diego #das #auto – Auto&Car
    Low Cost Auto Insurance #auto #loans #for #people #with #bad #credit – Auto&Car
    Best and Worst Times to Buy a New Car #kendall #auto #group – Auto&Car
    Ceja Auto Upholstery Supplies, auto upholstery supplies.#Auto #upholstery #supplies – Auto&Car
    Best car under $2000? #auto #loan #calculator – Auto&Car
    2015 Detroit Auto Show #car #finder – Auto&Car
    Electrical PDF courses ~ Electrical Knowhow #online #electrical #courses, #free, #electrical #software, #electrical #books, #electrical #spreadsheets, #electrical #design, #sound #system #design #course, #voltage, #power, former, #current, #voltage #drop, #generator, #circuit #breaker, #fuse, #cable, #low #voltage, #high #voltage, #wire, #power #factor, Getting Started | WonderDB #block, #cad #drawing, #nec #code, #nfpa #70, #method #statement, #electrical #procurement, #tendering, #short #circuit, #over #voltage, #switch, #receptacle, #ligh #fixture, #lighting, #grounding, #bonding, #earthing, #lightning, #raceway, #fire #alarm, #smoke #detector, #bms, #cctv, #switchgear, #panel, #busbar, #automatic fer #switch, #demand #factor, #capacitor, #resistance, #coil, #battery, #ampere, #horsepower, #watt, #switchboard, #schedule, #single #line #diagram, #quantity #survey, #bill #of #quantities, #specification, #copper, #aluminum, #sensor, #strobe – Auto&Car
    Student Auto Loans – Auto Loans for Students, bankruptcy auto loans.#Bankruptcy #auto #loans – Auto&Car
    ECommerce Website Design and Professional Web Design by OuterBox – Ecommerce Website Development Company #ecommerce #web #design, #ecommerce #website #design, #ecommerce #design, #ecommerce #websites, #professional #web #design, #professional #website #design, #web #development, #ecommerce #website #development – Auto&Car
    Pensacola Auto Mart, Inc, auto mart.#Auto #mart – Auto&Car
    Chrome Rims, Custom Wheels and Tires – Auto&Car
    Auto shippers #auto #part #warehouse – Auto&Car
    Honda Civic Parts and Accessories at #track #auto – Auto&Car
    Holiday autos: de autoverhuur met alles inbegrepen #auto #headlights – Auto&Car
    About – Arnold Air Conditioning Inc #arnold #air #conditioning – Auto&Car
    Plymouth Rock New Jersey #auto #city – Auto&Car
    Quick Auto Inc in South Bend Indiana Michelle Moore – Auto Sales Used Cars #auto #parts #wholesale – Auto&Car
    Auto insurance specialists #used #auto #glass – Auto&Car
    Year one classic car parts restoration, year one classic car parts restoration wholesale for sale page1 in #auto #service #manuals – Auto&Car
    Mesa Auto Repair Shop #international #auto #parts – Auto&Car
    Used Cars Available for Less Than $1, 000 at Capital Auto Auctions Weekly Online Auctions in Washington D. C, Maryland, and Pennsylvania #chilton #auto #repair #manual – Auto&Car
    The 2016 Top 500 Design Firms #engineering #consulting #firms,top #engineering #firms,engineering #companies,engineering #news-record,top #design #firms,2016, #news, #construction, #engineering, #architecture, #construction #news, #buildings, #building #technology, #building #renovation, #building #collapse, #highway #construction, #bridge #construction – Auto&Car
    USA Auto Appraisers – Auto Appraisals, Simple Car Appraisal #online #auto #insurance s – Auto&Car
    Long Island s 10 largest public companies #long #island #insurance #company – Auto&Car
    Alcoholics hotline #alcoholics #hotline – Auto&Car
    Ripoff Report #chevrolet #auto #parts – Auto&Car
    Las Vegas Car Loans #salvage #auto – Auto&Car
    Car Insurance: Compare Car Insurance Quotes #cheapest #auto #insurance – Auto&Car
    Crafts Auto Restoration Services, auto restoration.#Auto #restoration – Auto&Car
    Auto Shopper – Repair #am #auto #parts – Auto&Car
    Battery Center #loan #calculator #auto – Auto&Car
    Westbury Jeep Chrysler Dodge Long Island #detroit #auto #auction – Auto&Car
    O – Connor Auto Park #commercial #auto #insurance – Auto&Car
    State of Delaware – Department of Insurance – Compare Rates #auto #audio – Auto&Car
    Phoenix, AR Government Auctions: Police auctions – Auto&Car
    Chilton Service and Repair Manuals on Sale: Best Prices #auto #plac – Auto&Car
    Auto Parts: Car Parts, Truck Parts, Aftermarket Parts, ACDelco, gm auto parts.#Gm #auto #parts – Auto&Car
    Car Leasing Brooklyn – Staten Island New York #auto #shippers – Auto&Car
    Apply for Disability in Michigan – Office Locations, Resources #social #security #disability #michigan, #social #security #disability #detroit, #social #security #disability #mi – Auto&Car
    Maaco Collision Repair & Auto Painting, 7229 S, auto paint shops.#Auto #paint #shops – Auto&Car
    Infinity Sedan #used #cars #for #sale – Auto&Car
    Best Used Cars Under 2000 Dollars, Top Used Cars Under $2000 For Sale #find #a #car – Auto&Car
    Syslog-ng – Log Management Software #syslog #host – Auto&Car
    10 Best Used Cars Of 2013 #toronto #auto #show – Auto&Car
    Car Insurance Prices – State Farm. #online #car #sales – Auto&Car
    Donating a Car to Charity #local #used #cars – Auto&Car
    Buy Car Parts Online #auto #insurance – Auto&Car
    Parts & Accessories – Kia Motors Malta #used #auto #body #parts – Auto&Car
    Honda Parts #auto s – Auto&Car
    Auto Car Panel Beaters #auto #usate – Auto&Car
    NAPA AUTO PARTS #am #auto #parts – Auto&Car
    Prestige Auto Sales – Used Diesel Pickups – Brillion WI Dealer #auto #junk #yards – Auto&Car
    How to Get a Surety Bond Released #surety #bond #new #jersey – Auto&Car
    Import auto parts, import auto parts.#Import #auto #parts – Auto&Car
    Used Car Dealerships Richmond, Chesterfield, Midlothian VA #auto #tires – Auto&Car
    World Autoparts INC in Lorain, OH 44055, world auto parts.#World #auto #parts – Auto&Car
    Auto price finder #import #auto #parts – Auto&Car
    Houston, TX Plumber #plumbing #services #houston #tx – Auto&Car
    Greenville Personal Injury Attorney #personal #injury #lawyer #ri – Auto&Car
    St. Louis Metro Auto Body Centers #good #used #cars – Auto&Car
    How do I find Apache http server log files? #appache #log – Auto&Car
    Cheap Auto Insurance Quotes in Connecticut #auto #part #store – Auto&Car
    Wells Fargo – Personal & Business Banking – Student, Auto & Home Loans – Investing & Insurance #auto #value – Auto&Car
    Used Car Dealers, AA Cars, used car dealerships.#Used #car #dealerships – Auto&Car
    Used Auto Parts For Sale Online, Car Parts Locator, auto parts locator.#Auto #parts #locator – Auto&Car
    Auto Biweekly Loan Calculator #fallon #auto #mall – Auto&Car
    Collision Repair Service – Gerber Collision & Glass, auto collision repair.#Auto #collision #repair – Auto&Car
    Salinas Auto Mall: English – USA and Canada: Middle Age Male #auto #headlights – Auto&Car
    Benign mesothelioma – Canadian Cancer Society #benign #mesothelioma, #cancer #information #mesothelioma #benign #mesothelioma – Auto&Car
    Fresh Start Loan #auto #lease #calculator – Auto&Car
    DISCOUNT AUTO SALES – Used Cars – Mountain Home AR Dealer #mercedes #auto – Auto&Car
    Video shows public defender asking trooper not to arrest him on DUI charge – Orlando Sentinel #derreck #quarles, #arrested, #dui, #oui, #alcohol, #seminole #county – Auto&Car
    Cornerstone Drug Treatment Program Contact Info, Reviews and Feedback #cornerstone #drug #rehab – Auto&Car
    O Reilly Automotive Application for Employment, oreilly auto part.#Oreilly #auto #part – Auto&Car
    Toyota Corolla used cars for sale by owner. #cheap #used #cars #for #sale – Auto&Car
    Volusion store design #volusion #store #design – Auto&Car
    Post Master – s Certificate in Nurse Anesthesia #school #nurse #certificate #programs – Auto&Car
    Solomon Car Sales Ltd #auto #trade – Auto&Car
    Cars – Public Car Auction – Every Saturday Interstate Auto Auction, public auto auctions.#Public #auto #auctions – Auto&Car
    10 Tips for Buying a Car at Auction #auto port – Auto&Car
    Auto Parts in Chicago, IL, auto parts chicago.#Auto #parts #chicago – Auto&Car
    Cars For Sale By Owner #mercury #auto – Auto&Car
    Welcome to http. #auto #performance #parts – Auto&Car
    Auto Loan Calculator #led #auto #lights – Auto&Car
    Home Equity Car Loan: Purchase Your Car With a Home Equity Loan #orielys #auto #parts – Auto&Car
    Used Auto Parts, US Auto Supply Inc, us auto.#Us #auto – Auto&Car
    QUALITY AUTO SALES – Used Cars – HIGHLAND PARK IL Dealer #bill #of #sale #auto – Auto&Car
    Ontario Car Loans – Auto&Car
    Prestige Auto Group #auto #batteries – Auto&Car
    Extended auto warranties#Extended #auto #warranties – Auto&Car
    Auto Spares & Salvage Ltd, Northampton #auto #accident #lawyer – Auto&Car
    Mercedes-Benz Parts #mazda #auto #parts – Auto&Car
    Atlanta Business & Commercial Lawyers – Local Attorneys & Law Firms in Atlanta, GA #atlanta #business #lawyers – Auto&Car
    Hendrick Kia of Cary: Raleigh Area New Kia and Used Car Dealer – Auto&Car
    Used Trucks, Trailers for Sale, Custom 4×4 Pickup Trucks, Heavy, Medium, Light Duty Trucks for Sale – The Truck Guide – Auto&Car
    Used Mercedes-Benz S-Class, Mercedes-Benz S-Class For Sale #car #sales #uk – Auto&Car
    5 Tips for Choosing the Right Auto Body Shop, auto body repair.#Auto #body #repair – Auto&Car
    Car Refinance, Auto Loan Refinancing, OpenRoad Lending, auto financing calculator.#Auto #financing #calculator – Auto&Car
    Used Cars #oriley #auto #parts – Auto&Car
    Nationwide Auto Transport #discount #auto #parts #locations – Auto&Car
    Auto Transport #used #jeeps #for #sale – Auto&Car
    Home: Free VIN Decoder – Vehicle Identification Number Check #cheap #auto #glass – Auto&Car
    Damaged Cars Make Cheap Deals – by – Auto&Car
    Free web statistics, phpMyVisites web analytics #statistics, #analytics, #analysis, #referrer, #stats, #free, #open #source, #visits, #search #engines, #keywords, #web, #websites – Auto&Car
    Geneva Motor Show – News, Photos, and Highlights, Autoweek, geneva auto show.#Geneva #auto #show – Auto&Car

Leave a Reply