diff --git a/server/.main.go.swp b/server/.main.go.swp new file mode 100644 index 0000000000000000000000000000000000000000..d3340cb2af545f7c8a27cfdbb425b147484d8708 Binary files /dev/null and b/server/.main.go.swp differ diff --git a/server/loader/main.go b/server/loader/main.go index 7df3c9013bb59781ebf5416bb56b9eaa0676c803..bb28ea70aceeb80faec07b3c2ca0aec8ff28a88a 100644 --- a/server/loader/main.go +++ b/server/loader/main.go @@ -38,6 +38,7 @@ var rdfGzips = flag.String("rdfgzips", "", var mod = flag.Uint64("mod", 1, "Only pick entities, where uid % mod == 0.") var postingDir = flag.String("postings", "", "Directory to store posting lists") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") +var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process") func main() { flag.Parse() @@ -54,7 +55,7 @@ func main() { } logrus.SetLevel(logrus.InfoLevel) - numCpus := runtime.NumCPU() + numCpus := *numcpu prevProcs := runtime.GOMAXPROCS(numCpus) glog.WithField("num_cpu", numCpus). WithField("prev_maxprocs", prevProcs). diff --git a/server/main.go b/server/main.go index bc526b3ff59e8a578964b658837c504392354b50..f9c692ee4f41dbafe505945e956f08331bca1f64 100644 --- a/server/main.go +++ b/server/main.go @@ -38,6 +38,7 @@ var glog = x.Log("server") var postingDir = flag.String("postings", "", "Directory to store posting lists") var mutationDir = flag.String("mutations", "", "Directory to store mutations") var port = flag.String("port", "8080", "Port to run server on.") +var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process") func addCorsHeaders(w http.ResponseWriter) { w.Header().Set("Access-Control-Allow-Origin", "*") @@ -109,7 +110,7 @@ func main() { glog.Fatal("Unable to parse flags") } logrus.SetLevel(logrus.InfoLevel) - numCpus := runtime.NumCPU() + numCpus := *numcpu prev := runtime.GOMAXPROCS(numCpus) glog.WithField("num_cpu", numCpus). WithField("prev_maxprocs", prev). diff --git a/server/uidassigner/main.go b/server/uidassigner/main.go index 80bbe18b72e79c92c8b104231bb8f2618be04245..c9babee4daae968ab8415aef04c06301459b5dab 100644 --- a/server/uidassigner/main.go +++ b/server/uidassigner/main.go @@ -22,6 +22,7 @@ var rdfGzips = flag.String("rdfgzips", "", var mod = flag.Uint64("mod", 1, "Only pick entities, where uid % mod == 0.") var uidDir = flag.String("uidpostings", "", "Directory to store xid to uid posting lists") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") +var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process") func main() { flag.Parse() @@ -39,7 +40,7 @@ func main() { logrus.SetLevel(logrus.InfoLevel) - numCpus := runtime.NumCPU() + numCpus := *numcpu prevProcs := runtime.GOMAXPROCS(numCpus) glog.WithField("num_cpus", numCpus). WithField("prev_maxprocs", prevProcs).