This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Description | Mean (ms) | p95 (ms) | Transactions/s | |
|---|---|---|---|---|
| Writing to 3 collections with transactions | 8 | 9 | 3625 | |
| Writing to 3 collections without transactions | 17 | 17 | 1905 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Schema | Mean (ms) | p95(ms) | Transactions/s | |
|---|---|---|---|---|
| Reading from Transaction (including BalanceHistory) | 27 | 50 | 4582 | |
| Reading from Balance with 10 cached Balance Histories | 6 | 7 | 20631 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Schema | Mean(ms) | p95(ms) | Transactions/s | |
|---|---|---|---|---|
| Original - 3 writes | 11 | 12 | 4161 | |
| Two write version | 10 | 12 | 5822 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Server | vCPU | RAM | IOPS | Transactions/s | Mean (ms) | p95(ms) | Notes | |
|---|---|---|---|---|---|---|---|---|
| M30 | 2 | 8 | 3000 | 1265 | 25 | 28 | Higher latency got a little more throughput, more client threads | |
| M50 | 8 | 32 | 3000 | 3794 | 12 | 14 | 60% CPU, notable checkpointing, notable read cache, disk latency >10ms | |
| M50+4TB Disk | 8 | 32 | 8000 | 4161 | 11 | 12 | CPU 83%, no checkpoints | |
| M60 +4TB Disk | 16 | 64 | 8000 | 6721 | 9 | 10 | Not quite linear performance improvement | |
| M80+4TB Disk | 32 | 128 | 8000 | 6995 | 9 | 10 | Unsure what limit was at this point, probably disk; shows M60 + sharding better option |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String getMOTResultInJSON(String identifier) { | |
| long identifierLong; | |
| try { | |
| identifierLong = Long.valueOf(identifier); | |
| Bson byIdQuery = Filters.eq("vehicleid", identifierLong); | |
| testObj = testresults.find(byIdQuery).limit(1).first(); | |
| if (testObj != null) { | |
| return testObj.toJson(); | |
| } | |
| } catch (Exception e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Query From https://data.dft.gov.uk/anonymised-mot-test/MOT_user_guide_v4.docx | |
| private final String getlatestByVehicleSQL = "select " + | |
| "tr.*, " + | |
| "ft.FUEL_TYPE, " + | |
| "tt.TESTTYPE AS TYPENAME, " + | |
| "to2.RESULT, " + | |
| "ti.*, " + | |
| "fl.*, " + "tid.MINORITEM,tid.RFRDESC,tid.RFRLOCMARKER,tid.RFRINSPMANDESC,tid.RFRADVISORYTEXT,tid.TSTITMSETSECID, " + | |
| "b.ITEMNAME AS LEVEL1, " + | |
| "c.ITEMNAME AS LEVEL2, " + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| CustomerId: 123, | |
| Name : { First: "John", Last: "Page"}, | |
| TotalSpend: 261, | |
| Purchases: [ | |
| { PurchaseID: 519, Item: 25, Quantity: 2, Price: 50 }, | |
| { PurchaseID: 530, Item: 25, Quantity: 1, Price: 180 }, | |
| { PurchaseId: 640, Item: 9, Quantity: 1, Price: 31 } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports = async function() { | |
| let APIKEY = context.values.get('ifftkey_value') | |
| const collection = context.services.get("mongodb-atlas").db("energy").collection("meter"); | |
| const docs = await collection.find({ type: "electric" }).sort({_id:-1}).limit(1).toArray(); | |
| if(docs.length == 1) | |
| { | |
| if(docs[0].solarwatts > 800) { | |
| console.log("turning off lights") | |
| const response = context.http.get({ url: `https://maker.ifttt.com/trigger/AllLightsOff/with/key/${APIKEY}` }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { $match: { type: "electric" } }, | |
| { $unwind: "$devices" }, | |
| { $match: { "devices.watts": { $gt: 0 } } }, | |
| { $setWindowFields: { sortBy: { date: 1 }, partitionBy: "$devices.name", | |
| output: { totalUsage: { $integral: { input: "$devices.watts", unit: "hour" } } } }}, | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { $match: { type: "electric" } }, | |
| { | |
| $setWindowFields: | |
| { | |
| sortBy: { date: 1 }, | |
| output: { | |
| smoothsumusage: { | |
| $expMovingAvg: { input: { $sum: "$devices.watts"} , alpha: 0.9} | |
| } |
NewerOlder