-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added Request to context as helper function * wip poison wg * fixed child poison with waitgroup * remove .vscode stuff * bench * benching * ecorrect placement of runtime.LockosThread() * LOCK_OS_THREAD = false for testing * Updated README * minor improvements and private pid separator * fixed typo * updated README * updated README * added chat example
- Loading branch information
Showing
33 changed files
with
782 additions
and
146 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
bin | ||
TODO.txt | ||
TODO | ||
_test | ||
_test | ||
.vscode |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
"time" | ||
|
||
"github.com/anthdm/hollywood/actor" | ||
"github.com/anthdm/hollywood/log" | ||
"github.com/anthdm/hollywood/remote" | ||
) | ||
|
||
func makeRemoteEngine(addr string) *actor.Engine { | ||
e := actor.NewEngine() | ||
r := remote.New(e, remote.Config{ListenAddr: addr}) | ||
e.WithRemote(r) | ||
return e | ||
} | ||
|
||
func benchmarkRemote() { | ||
var ( | ||
a = makeRemoteEngine("127.0.0.1:3000") | ||
b = makeRemoteEngine("127.0.0.1:3001") | ||
pidB = b.SpawnFunc(func(c *actor.Context) {}, "bench", actor.WithInboxSize(1024*8)) | ||
) | ||
its := []int{ | ||
1_000_000, | ||
10_000_000, | ||
} | ||
for i := 0; i < len(its); i++ { | ||
start := time.Now() | ||
for j := 0; j < its[i]; j++ { | ||
a.Send(pidB, pidB) | ||
} | ||
fmt.Printf("[BENCH HOLLYWOOD REMOTE] processed %d messages in %v\n", its[i], time.Since(start)) | ||
} | ||
} | ||
|
||
func benchmarkLocal() { | ||
e := actor.NewEngine() | ||
pid := e.SpawnFunc(func(c *actor.Context) {}, "bench", actor.WithInboxSize(1024*8)) | ||
its := []int{ | ||
1_000_000, | ||
10_000_000, | ||
} | ||
payload := make([]byte, 128) | ||
for i := 0; i < len(its); i++ { | ||
start := time.Now() | ||
for j := 0; j < its[i]; j++ { | ||
e.Send(pid, payload) | ||
} | ||
fmt.Printf("[BENCH HOLLYWOOD LOCAL] processed %d messages in %v\n", its[i], time.Since(start)) | ||
} | ||
} | ||
|
||
func main() { | ||
if runtime.GOMAXPROCS(runtime.NumCPU()) == 1 { | ||
log.Fatalw("Please use a system with more than 1 CPU. Its 2023...", nil) | ||
} | ||
log.SetLevel(log.LevelPanic) | ||
benchmarkLocal() | ||
benchmarkRemote() | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.