This repository has been archived by the owner on Aug 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
limits.go
42 lines (34 loc) · 1.48 KB
/
limits.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2014 Project Iris. All rights reserved.
//
// The current language binding is an official support library of the Iris
// cloud messaging framework, and as such, the same licensing terms apply.
// For details please see http://iris.karalabe.com/downloads#License
// Contains the default service, topic and tunnel limits used by the binding.
package iris
import "runtime"
// User limits of the threading and memory usage of a registered service.
type ServiceLimits struct {
BroadcastThreads int // Broadcast handlers to execute concurrently
BroadcastMemory int // Memory allowance for pending broadcasts
RequestThreads int // Request handlers to execute concurrently
RequestMemory int // Memory allowance for pending requests
}
// User limits of the threading and memory usage of a subscription.
type TopicLimits struct {
EventThreads int // Event handlers to execute concurrently
EventMemory int // Memory allowance for pending events
}
// Default limits of the threading and memory usage of a registered service.
var defaultServiceLimits = ServiceLimits{
BroadcastThreads: 4 * runtime.NumCPU(),
BroadcastMemory: 64 * 1024 * 1024,
RequestThreads: 4 * runtime.NumCPU(),
RequestMemory: 64 * 1024 * 1024,
}
// Default limits of the threading and memory usage of a subscription.
var defaultTopicLimits = TopicLimits{
EventThreads: 4 * runtime.NumCPU(),
EventMemory: 64 * 1024 * 1024,
}
// Size of a tunnel's input buffer.
var defaultTunnelBuffer = 64 * 1024 * 1024