View arangodb.js
// initialize
// The maximum number of requests is equal to
// maxSockets * 2 with keepAlive: true or equal to maxSockets with keepAlive: false.
const arangodb = new Arangojs.Database({
url: "http://localhost:8529", // Base URL of the ArangoDB server or list of server URLs.
agentOptions: {
maxSockets: 100,
keepAlive: true
},
loadBalancingStrategy: 'ROUND_ROBIN'
View index.js
"use strict";
const _ = require("lodash");
function groupByTimeWindow(start, end) {
return function(o) {
const date = new Date(o.timestamp);
if (date.getUTCHours() >= start && date.getUTCHours() <= end)
return o.consumption_Wh;
return 0;
View range-channels-backpressure.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var wg sync.WaitGroup
View range-channels.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var wg sync.WaitGroup
View event-loop-examples.js
/**
* setImmediate callbacks are fired off the event loop, once per iteration in the order that they were queued.
* So on the first iteration of the event loop, callback A is fired.
* Then on the second iteration of the event loop, callback B is fired, then on the third iteration of the event loop callback C is fired, etc.
* This prevents the event loop from being blocked and allows other I/O or timer callbacks to be called in the mean time (as is the case of the 0ms timeout, which is fired on the 1st or 2nd loop iteration).
*/
setImmediate(function A() {
setImmediate(function B() {
console.log(1);
View hemera-hapi.js
'use strict'
const Hapi = require('hapi')
const server = new Hapi.Server()
server.connection({ port: 80 })
server.register({
register: require('hapi-hemera'),
options: {
View hemera.js
/**
* Created by s.neidig on 15/03/17.
*/
const Hemera = require('nats-hemera');
const nats = require('nats');
const HemeraJoi = require('hemera-joi');
const connection = nats.connect('nats://0.0.0.0:4222');
const hemera = new Hemera(connection, {
View bundle-writer-example.js
// ************************************
// ***** bundle-writer-example.js *****
//*************************************
var myWriter = require('./bundle-writer');
module.exports = function (myLasso, pluginConfig) {
myLasso.config.writer = myWriter(pluginConfig, myLasso.config);
};
// ****************************
View request-reply-perf-realworld.js
var nc1 = require('../lib/nats').connect();
var nc2 = require('../lib/nats').connect();
var os = require('os')
///////////////////////////////////////
// Request Performance
///////////////////////////////////////
var start;
var loop = 100000;
var hash = 1000;
View memory-leak-pub.js
var nats = require('../lib/nats').connect();
///////////////////////////////////////
// Publish Performance
//
// Setup:
// NodeJs: 6.9.2, Windows 10
///////////////////////////////////////