All Projects → expectedsh → Go Sonic

expectedsh / Go Sonic

Sonic driver written in Go.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Sonic

Compose
A Hugo theme for documentation sites. It's inspired by https://forestry.io/docs/welcome/
Stars: ✭ 95 (-13.64%)
Mutual labels:  search
Node Sonic Channel
🦉 Sonic Channel integration for Node. Used in pair with Sonic, the fast, lightweight and schema-less search backend.
Stars: ✭ 101 (-8.18%)
Mutual labels:  search
Postgresql Dart
Dart PostgreSQL driver: supports extended query format, binary protocol and statement reuse.
Stars: ✭ 105 (-4.55%)
Mutual labels:  driver
Bthps3
Windows kernel-mode Bluetooth Profile & Filter Drivers for PS3 peripherals
Stars: ✭ 94 (-14.55%)
Mutual labels:  driver
Neo4j Core
A simple unified API that can access both the server and embedded Neo4j database. Used by the neo4j gem
Stars: ✭ 99 (-10%)
Mutual labels:  driver
Redux Search
Redux bindings for client-side search
Stars: ✭ 1,377 (+1151.82%)
Mutual labels:  search
React Instantsearch
⚡️ Lightning-fast search for React and React Native applications, by Algolia.
Stars: ✭ 1,320 (+1100%)
Mutual labels:  search
Java
All Algorithms implemented in Java
Stars: ✭ 42,893 (+38893.64%)
Mutual labels:  search
Simpleaudioindexer
Searching for the occurrence seconds of words/phrases or arbitrary regex patterns within audio files
Stars: ✭ 100 (-9.09%)
Mutual labels:  search
Ds2i
A library of inverted index data structures
Stars: ✭ 104 (-5.45%)
Mutual labels:  search
Logcatch
android adb logcat viewer for Linux/Mac/Windows
Stars: ✭ 95 (-13.64%)
Mutual labels:  search
Javascript
A repository for All algorithms implemented in Javascript (for educational purposes only)
Stars: ✭ 16,117 (+14551.82%)
Mutual labels:  search
Cloudboost
Realtime JavaScript Backend.
Stars: ✭ 1,378 (+1152.73%)
Mutual labels:  search
Hacksysextremevulnerabledriver
HackSys Extreme Vulnerable Windows Driver
Stars: ✭ 1,330 (+1109.09%)
Mutual labels:  driver
Grl
Robotics tools in C++11. Implements soft real time arm drivers for Kuka LBR iiwa plus V-REP, ROS, Constrained Optimization based planning, Hand Eye Calibration and Inverse Kinematics integration.
Stars: ✭ 105 (-4.55%)
Mutual labels:  driver
Mongoose Fuzzy Searching
Mongoose Fuzzy Searching Plugin
Stars: ✭ 94 (-14.55%)
Mutual labels:  search
Search
PHP search-systems made possible
Stars: ✭ 101 (-8.18%)
Mutual labels:  search
Smartmaterialspinner
The powerful android spinner library for your application
Stars: ✭ 108 (-1.82%)
Mutual labels:  search
Esp8266 Oled Ssd1306
Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
Stars: ✭ 1,590 (+1345.45%)
Mutual labels:  driver
Ghost Search
A simple but powerful search library for Ghost Blogging Platform.
Stars: ✭ 104 (-5.45%)
Mutual labels:  search

GoDoc GoLint

Go client for the sonic search backend

This package implement all commands to work with sonic. If there is one missing, open an issue ! :)

Sonic: https://github.com/valeriansaliou/sonic

Install

go get github.com/expectedsh/go-sonic

Example

package main

import (
	"fmt"
	"github.com/expectedsh/go-sonic/sonic"
)

func main() {

	ingester, err := sonic.NewIngester("localhost", 1491, "SecretPassword")
	if err != nil {
		panic(err)
	}

	// I will ignore all errors for demonstration purposes

	_ = ingester.BulkPush("movies", "general", 3, []sonic.IngestBulkRecord{
		{"id:6ab56b4kk3", "Star wars"},
		{"id:5hg67f8dg5", "Spider man"},
		{"id:1m2n3b4vf6", "Batman"},
		{"id:68d96h5h9d0", "This is another movie"},
	})

	search, err := sonic.NewSearch("localhost", 1491, "SecretPassword")
	if err != nil {
		panic(err)
	}

	results, _ := search.Query("movies", "general", "man", 10, 0)

	fmt.Println(results)
}

Benchmark bulk

Method BulkPush and BulkPop use custom connection pool with goroutine dispatch algorithm. This is the benchmark (file sonic/ingester_test.go):

goos: linux
goarch: amd64
pkg: github.com/expectedsh/go-sonic/sonic
BenchmarkIngesterChannel_BulkPushMaxCPUs-8   	       2	 662657959 ns/op
BenchmarkIngesterChannel_BulkPush10-8        	       2	 603779977 ns/op
BenchmarkIngesterChannel_Push-8              	       1	1023322864 ns/op
PASS

Bulk push is faster than for loop on Push. Hardware detail: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz

Thread Safety

The driver itself isn't thread safe. You could use locks or channels to avoid crashes.

package main

import (
	"fmt"

	"github.com/expectedsh/go-sonic/sonic"
)

func main() {
	events := make(chan []string, 1)

	event := []string{"some_text", "some_id"}
	tryCrash := func() {
		for {
			// replace "event" with whatever is giving you events: pubsub, amqp messages…
			events <- event
		}
	}

	go tryCrash()
	go tryCrash()
	go tryCrash()
	go tryCrash()

	ingester, _ := sonic.NewIngester("localhost", 1491, "SecretPassword")

	for {
		msg := <-events
		// Or use some buffering along with BulkPush
		ingester.Push("collection", "bucket", msg[1], msg[0])
	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].