├── .gitignore ├── GoGrpcClient ├── certs │ ├── README.md │ ├── ca.pem │ ├── server1.key │ └── server1.pem ├── go.mod ├── go.sum ├── grpc_testing │ ├── benchmark_service.pb.go │ └── messages.pb.go ├── main.go └── protos │ ├── benchmark_service.proto │ └── grpc │ └── testing │ └── messages.proto ├── GrpcCoreServer ├── GrpcCoreServer.csproj └── Program.cs ├── GrpcSampleClient ├── GrpcSampleClient.csproj ├── Program.cs └── PushUnaryContent.cs ├── GrpcSampleServer ├── Controller │ └── GreeterController.cs ├── GrpcSampleServer.csproj ├── Hubs │ └── GreeterHub.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── Protos │ └── greet.proto ├── Services │ └── GreeterService.cs ├── Startup.cs ├── appsettings.Development.json └── appsettings.json ├── Http2Perf.sln ├── LICENSE ├── NuGet.Config └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /GoGrpcClient/certs/README.md: -------------------------------------------------------------------------------- 1 | From https://github.com/grpc/grpc-go/tree/master/testdata -------------------------------------------------------------------------------- /GoGrpcClient/certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICSjCCAbOgAwIBAgIJAJHGGR4dGioHMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV 3 | BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMTBnRlc3RjYTAeFw0xNDExMTEyMjMxMjla 5 | Fw0yNDExMDgyMjMxMjlaMFYxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0 6 | YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDzANBgNVBAMT 7 | BnRlc3RjYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwEDfBV5MYdlHVHJ7 8 | +L4nxrZy7mBfAVXpOc5vMYztssUI7mL2/iYujiIXM+weZYNTEpLdjyJdu7R5gGUu 9 | g1jSVK/EPHfc74O7AyZU34PNIP4Sh33N+/A5YexrNgJlPY+E3GdVYi4ldWJjgkAd 10 | Qah2PH5ACLrIIC6tRka9hcaBlIECAwEAAaMgMB4wDAYDVR0TBAUwAwEB/zAOBgNV 11 | HQ8BAf8EBAMCAgQwDQYJKoZIhvcNAQELBQADgYEAHzC7jdYlzAVmddi/gdAeKPau 12 | sPBG/C2HCWqHzpCUHcKuvMzDVkY/MP2o6JIW2DBbY64bO/FceExhjcykgaYtCH/m 13 | oIU63+CFOTtR7otyQAWHqXa7q4SbCDlG7DyRFxqG0txPtGvy12lgldA2+RgcigQG 14 | Dfcog5wrJytaQ6UA0wE= 15 | -----END CERTIFICATE----- 16 | -------------------------------------------------------------------------------- /GoGrpcClient/certs/server1.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAOHDFScoLCVJpYDD 3 | M4HYtIdV6Ake/sMNaaKdODjDMsux/4tDydlumN+fm+AjPEK5GHhGn1BgzkWF+slf 4 | 3BxhrA/8dNsnunstVA7ZBgA/5qQxMfGAq4wHNVX77fBZOgp9VlSMVfyd9N8YwbBY 5 | AckOeUQadTi2X1S6OgJXgQ0m3MWhAgMBAAECgYAn7qGnM2vbjJNBm0VZCkOkTIWm 6 | V10okw7EPJrdL2mkre9NasghNXbE1y5zDshx5Nt3KsazKOxTT8d0Jwh/3KbaN+YY 7 | tTCbKGW0pXDRBhwUHRcuRzScjli8Rih5UOCiZkhefUTcRb6xIhZJuQy71tjaSy0p 8 | dHZRmYyBYO2YEQ8xoQJBAPrJPhMBkzmEYFtyIEqAxQ/o/A6E+E4w8i+KM7nQCK7q 9 | K4JXzyXVAjLfyBZWHGM2uro/fjqPggGD6QH1qXCkI4MCQQDmdKeb2TrKRh5BY1LR 10 | 81aJGKcJ2XbcDu6wMZK4oqWbTX2KiYn9GB0woM6nSr/Y6iy1u145YzYxEV/iMwff 11 | DJULAkB8B2MnyzOg0pNFJqBJuH29bKCcHa8gHJzqXhNO5lAlEbMK95p/P2Wi+4Hd 12 | aiEIAF1BF326QJcvYKmwSmrORp85AkAlSNxRJ50OWrfMZnBgzVjDx3xG6KsFQVk2 13 | ol6VhqL6dFgKUORFUWBvnKSyhjJxurlPEahV6oo6+A+mPhFY8eUvAkAZQyTdupP3 14 | XEFQKctGz+9+gKkemDp7LBBMEMBXrGTLPhpEfcjv/7KPdnFHYmhYeBTBnuVmTVWe 15 | F98XJ7tIFfJq 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /GoGrpcClient/certs/server1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICnDCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJBVTET 3 | MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ 4 | dHkgTHRkMQ8wDQYDVQQDEwZ0ZXN0Y2EwHhcNMTUxMTA0MDIyMDI0WhcNMjUxMTAx 5 | MDIyMDI0WjBlMQswCQYDVQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNV 6 | BAcTB0NoaWNhZ28xFTATBgNVBAoTDEV4YW1wbGUsIENvLjEaMBgGA1UEAxQRKi50 7 | ZXN0Lmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOHDFSco 8 | LCVJpYDDM4HYtIdV6Ake/sMNaaKdODjDMsux/4tDydlumN+fm+AjPEK5GHhGn1Bg 9 | zkWF+slf3BxhrA/8dNsnunstVA7ZBgA/5qQxMfGAq4wHNVX77fBZOgp9VlSMVfyd 10 | 9N8YwbBYAckOeUQadTi2X1S6OgJXgQ0m3MWhAgMBAAGjazBpMAkGA1UdEwQCMAAw 11 | CwYDVR0PBAQDAgXgME8GA1UdEQRIMEaCECoudGVzdC5nb29nbGUuZnKCGHdhdGVy 12 | em9vaS50ZXN0Lmdvb2dsZS5iZYISKi50ZXN0LnlvdXR1YmUuY29thwTAqAEDMA0G 13 | CSqGSIb3DQEBCwUAA4GBAJFXVifQNub1LUP4JlnX5lXNlo8FxZ2a12AFQs+bzoJ6 14 | hM044EDjqyxUqSbVePK0ni3w1fHQB5rY9yYC5f8G7aqqTY1QOhoUk8ZTSTRpnkTh 15 | y4jjdvTZeLDVBlueZUTDRmy2feY5aZIU18vFDK08dTG0A87pppuv1LNIR3loveU8 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /GoGrpcClient/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/grpc/grpc-dotnet 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/golang/protobuf v1.3.3 7 | github.com/gorilla/mux v1.7.3 8 | github.com/sirupsen/logrus v1.4.2 9 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect 10 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2 11 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect 12 | google.golang.org/grpc v1.27.1 13 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /GoGrpcClient/go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 3 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 4 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 5 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 6 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 7 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 8 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 9 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 10 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 11 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 12 | github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= 13 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 14 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 15 | github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= 16 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 17 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 18 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 19 | github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 20 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 21 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 22 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 23 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 24 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 25 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 26 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 27 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 28 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 29 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 30 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 31 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= 32 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 33 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 34 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 35 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 36 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 37 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 38 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 39 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 40 | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= 41 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 42 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 43 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 44 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 45 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 46 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 47 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 48 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 49 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= 50 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 51 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 52 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 53 | google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= 54 | google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 55 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 56 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 57 | -------------------------------------------------------------------------------- /GoGrpcClient/grpc_testing/benchmark_service.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // source: benchmark_service.proto 3 | 4 | package grpc_testing 5 | 6 | import ( 7 | context "context" 8 | fmt "fmt" 9 | proto "github.com/golang/protobuf/proto" 10 | grpc "google.golang.org/grpc" 11 | codes "google.golang.org/grpc/codes" 12 | status "google.golang.org/grpc/status" 13 | math "math" 14 | ) 15 | 16 | // Reference imports to suppress errors if they are not otherwise used. 17 | var _ = proto.Marshal 18 | var _ = fmt.Errorf 19 | var _ = math.Inf 20 | 21 | // This is a compile-time assertion to ensure that this generated file 22 | // is compatible with the proto package it is being compiled against. 23 | // A compilation error at this line likely means your copy of the 24 | // proto package needs to be updated. 25 | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 26 | 27 | func init() { proto.RegisterFile("benchmark_service.proto", fileDescriptor_064376c4ccaa1264) } 28 | 29 | var fileDescriptor_064376c4ccaa1264 = []byte{ 30 | // 197 bytes of a gzipped FileDescriptorProto 31 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x4a, 0xcd, 0x4b, 32 | 0xce, 0xc8, 0x4d, 0x2c, 0xca, 0x8e, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 33 | 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x2b, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 34 | 0x4b, 0x97, 0xe2, 0xcb, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x2d, 0x86, 0xc8, 0x1a, 0x2d, 0x63, 35 | 0xe6, 0x12, 0x70, 0x82, 0xe9, 0x0c, 0x86, 0x68, 0x14, 0x72, 0xe3, 0xe2, 0x0c, 0xcd, 0x4b, 0x2c, 36 | 0xaa, 0x74, 0x4e, 0xcc, 0xc9, 0x11, 0x92, 0xd6, 0x43, 0x36, 0x40, 0x2f, 0x38, 0x33, 0xb7, 0x20, 37 | 0x27, 0x35, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x4a, 0x06, 0xbb, 0x64, 0x71, 0x41, 0x7e, 38 | 0x5e, 0x71, 0xaa, 0x90, 0x1f, 0x17, 0x6f, 0x70, 0x49, 0x51, 0x6a, 0x62, 0x6e, 0x66, 0x5e, 0x3a, 39 | 0x85, 0x66, 0x69, 0x30, 0x1a, 0x30, 0x0a, 0x05, 0x71, 0x09, 0xc3, 0xcd, 0x73, 0x2b, 0xca, 0xcf, 40 | 0x75, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0xa1, 0xc8, 0x54, 0x0c, 0x33, 0x41, 0x61, 0x90, 0x5a, 0x44, 41 | 0x81, 0x99, 0x60, 0x77, 0x0a, 0xc2, 0xcd, 0x74, 0xca, 0x2f, 0xc9, 0x08, 0x4f, 0xac, 0x2c, 0xa6, 42 | 0xd0, 0xef, 0x49, 0x6c, 0xe0, 0xf8, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x77, 0xb6, 43 | 0xf4, 0xe8, 0x01, 0x00, 0x00, 44 | } 45 | 46 | // Reference imports to suppress errors if they are not otherwise used. 47 | var _ context.Context 48 | var _ grpc.ClientConn 49 | 50 | // This is a compile-time assertion to ensure that this generated file 51 | // is compatible with the grpc package it is being compiled against. 52 | const _ = grpc.SupportPackageIsVersion4 53 | 54 | // BenchmarkServiceClient is the client API for BenchmarkService service. 55 | // 56 | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 57 | type BenchmarkServiceClient interface { 58 | // One request followed by one response. 59 | // The server returns the client payload as-is. 60 | UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) 61 | // Repeated sequence of one request followed by one response. 62 | // Should be called streaming ping-pong 63 | // The server returns the client payload as-is on each response 64 | StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error) 65 | // Single-sided unbounded streaming from client to server 66 | // The server returns the client payload as-is once the client does WritesDone 67 | StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingFromClientClient, error) 68 | // Single-sided unbounded streaming from server to client 69 | // The server repeatedly returns the client payload as-is 70 | StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (BenchmarkService_StreamingFromServerClient, error) 71 | // Two-sided unbounded streaming between server to client 72 | // Both sides send the content of their own choice to the other 73 | StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingBothWaysClient, error) 74 | } 75 | 76 | type benchmarkServiceClient struct { 77 | cc *grpc.ClientConn 78 | } 79 | 80 | func NewBenchmarkServiceClient(cc *grpc.ClientConn) BenchmarkServiceClient { 81 | return &benchmarkServiceClient{cc} 82 | } 83 | 84 | func (c *benchmarkServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { 85 | out := new(SimpleResponse) 86 | err := c.cc.Invoke(ctx, "/grpc.testing.BenchmarkService/UnaryCall", in, out, opts...) 87 | if err != nil { 88 | return nil, err 89 | } 90 | return out, nil 91 | } 92 | 93 | func (c *benchmarkServiceClient) StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error) { 94 | stream, err := c.cc.NewStream(ctx, &_BenchmarkService_serviceDesc.Streams[0], "/grpc.testing.BenchmarkService/StreamingCall", opts...) 95 | if err != nil { 96 | return nil, err 97 | } 98 | x := &benchmarkServiceStreamingCallClient{stream} 99 | return x, nil 100 | } 101 | 102 | type BenchmarkService_StreamingCallClient interface { 103 | Send(*SimpleRequest) error 104 | Recv() (*SimpleResponse, error) 105 | grpc.ClientStream 106 | } 107 | 108 | type benchmarkServiceStreamingCallClient struct { 109 | grpc.ClientStream 110 | } 111 | 112 | func (x *benchmarkServiceStreamingCallClient) Send(m *SimpleRequest) error { 113 | return x.ClientStream.SendMsg(m) 114 | } 115 | 116 | func (x *benchmarkServiceStreamingCallClient) Recv() (*SimpleResponse, error) { 117 | m := new(SimpleResponse) 118 | if err := x.ClientStream.RecvMsg(m); err != nil { 119 | return nil, err 120 | } 121 | return m, nil 122 | } 123 | 124 | func (c *benchmarkServiceClient) StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingFromClientClient, error) { 125 | stream, err := c.cc.NewStream(ctx, &_BenchmarkService_serviceDesc.Streams[1], "/grpc.testing.BenchmarkService/StreamingFromClient", opts...) 126 | if err != nil { 127 | return nil, err 128 | } 129 | x := &benchmarkServiceStreamingFromClientClient{stream} 130 | return x, nil 131 | } 132 | 133 | type BenchmarkService_StreamingFromClientClient interface { 134 | Send(*SimpleRequest) error 135 | CloseAndRecv() (*SimpleResponse, error) 136 | grpc.ClientStream 137 | } 138 | 139 | type benchmarkServiceStreamingFromClientClient struct { 140 | grpc.ClientStream 141 | } 142 | 143 | func (x *benchmarkServiceStreamingFromClientClient) Send(m *SimpleRequest) error { 144 | return x.ClientStream.SendMsg(m) 145 | } 146 | 147 | func (x *benchmarkServiceStreamingFromClientClient) CloseAndRecv() (*SimpleResponse, error) { 148 | if err := x.ClientStream.CloseSend(); err != nil { 149 | return nil, err 150 | } 151 | m := new(SimpleResponse) 152 | if err := x.ClientStream.RecvMsg(m); err != nil { 153 | return nil, err 154 | } 155 | return m, nil 156 | } 157 | 158 | func (c *benchmarkServiceClient) StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (BenchmarkService_StreamingFromServerClient, error) { 159 | stream, err := c.cc.NewStream(ctx, &_BenchmarkService_serviceDesc.Streams[2], "/grpc.testing.BenchmarkService/StreamingFromServer", opts...) 160 | if err != nil { 161 | return nil, err 162 | } 163 | x := &benchmarkServiceStreamingFromServerClient{stream} 164 | if err := x.ClientStream.SendMsg(in); err != nil { 165 | return nil, err 166 | } 167 | if err := x.ClientStream.CloseSend(); err != nil { 168 | return nil, err 169 | } 170 | return x, nil 171 | } 172 | 173 | type BenchmarkService_StreamingFromServerClient interface { 174 | Recv() (*SimpleResponse, error) 175 | grpc.ClientStream 176 | } 177 | 178 | type benchmarkServiceStreamingFromServerClient struct { 179 | grpc.ClientStream 180 | } 181 | 182 | func (x *benchmarkServiceStreamingFromServerClient) Recv() (*SimpleResponse, error) { 183 | m := new(SimpleResponse) 184 | if err := x.ClientStream.RecvMsg(m); err != nil { 185 | return nil, err 186 | } 187 | return m, nil 188 | } 189 | 190 | func (c *benchmarkServiceClient) StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingBothWaysClient, error) { 191 | stream, err := c.cc.NewStream(ctx, &_BenchmarkService_serviceDesc.Streams[3], "/grpc.testing.BenchmarkService/StreamingBothWays", opts...) 192 | if err != nil { 193 | return nil, err 194 | } 195 | x := &benchmarkServiceStreamingBothWaysClient{stream} 196 | return x, nil 197 | } 198 | 199 | type BenchmarkService_StreamingBothWaysClient interface { 200 | Send(*SimpleRequest) error 201 | Recv() (*SimpleResponse, error) 202 | grpc.ClientStream 203 | } 204 | 205 | type benchmarkServiceStreamingBothWaysClient struct { 206 | grpc.ClientStream 207 | } 208 | 209 | func (x *benchmarkServiceStreamingBothWaysClient) Send(m *SimpleRequest) error { 210 | return x.ClientStream.SendMsg(m) 211 | } 212 | 213 | func (x *benchmarkServiceStreamingBothWaysClient) Recv() (*SimpleResponse, error) { 214 | m := new(SimpleResponse) 215 | if err := x.ClientStream.RecvMsg(m); err != nil { 216 | return nil, err 217 | } 218 | return m, nil 219 | } 220 | 221 | // BenchmarkServiceServer is the server API for BenchmarkService service. 222 | type BenchmarkServiceServer interface { 223 | // One request followed by one response. 224 | // The server returns the client payload as-is. 225 | UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) 226 | // Repeated sequence of one request followed by one response. 227 | // Should be called streaming ping-pong 228 | // The server returns the client payload as-is on each response 229 | StreamingCall(BenchmarkService_StreamingCallServer) error 230 | // Single-sided unbounded streaming from client to server 231 | // The server returns the client payload as-is once the client does WritesDone 232 | StreamingFromClient(BenchmarkService_StreamingFromClientServer) error 233 | // Single-sided unbounded streaming from server to client 234 | // The server repeatedly returns the client payload as-is 235 | StreamingFromServer(*SimpleRequest, BenchmarkService_StreamingFromServerServer) error 236 | // Two-sided unbounded streaming between server to client 237 | // Both sides send the content of their own choice to the other 238 | StreamingBothWays(BenchmarkService_StreamingBothWaysServer) error 239 | } 240 | 241 | // UnimplementedBenchmarkServiceServer can be embedded to have forward compatible implementations. 242 | type UnimplementedBenchmarkServiceServer struct { 243 | } 244 | 245 | func (*UnimplementedBenchmarkServiceServer) UnaryCall(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) { 246 | return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") 247 | } 248 | func (*UnimplementedBenchmarkServiceServer) StreamingCall(srv BenchmarkService_StreamingCallServer) error { 249 | return status.Errorf(codes.Unimplemented, "method StreamingCall not implemented") 250 | } 251 | func (*UnimplementedBenchmarkServiceServer) StreamingFromClient(srv BenchmarkService_StreamingFromClientServer) error { 252 | return status.Errorf(codes.Unimplemented, "method StreamingFromClient not implemented") 253 | } 254 | func (*UnimplementedBenchmarkServiceServer) StreamingFromServer(req *SimpleRequest, srv BenchmarkService_StreamingFromServerServer) error { 255 | return status.Errorf(codes.Unimplemented, "method StreamingFromServer not implemented") 256 | } 257 | func (*UnimplementedBenchmarkServiceServer) StreamingBothWays(srv BenchmarkService_StreamingBothWaysServer) error { 258 | return status.Errorf(codes.Unimplemented, "method StreamingBothWays not implemented") 259 | } 260 | 261 | func RegisterBenchmarkServiceServer(s *grpc.Server, srv BenchmarkServiceServer) { 262 | s.RegisterService(&_BenchmarkService_serviceDesc, srv) 263 | } 264 | 265 | func _BenchmarkService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 266 | in := new(SimpleRequest) 267 | if err := dec(in); err != nil { 268 | return nil, err 269 | } 270 | if interceptor == nil { 271 | return srv.(BenchmarkServiceServer).UnaryCall(ctx, in) 272 | } 273 | info := &grpc.UnaryServerInfo{ 274 | Server: srv, 275 | FullMethod: "/grpc.testing.BenchmarkService/UnaryCall", 276 | } 277 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 278 | return srv.(BenchmarkServiceServer).UnaryCall(ctx, req.(*SimpleRequest)) 279 | } 280 | return interceptor(ctx, in, info, handler) 281 | } 282 | 283 | func _BenchmarkService_StreamingCall_Handler(srv interface{}, stream grpc.ServerStream) error { 284 | return srv.(BenchmarkServiceServer).StreamingCall(&benchmarkServiceStreamingCallServer{stream}) 285 | } 286 | 287 | type BenchmarkService_StreamingCallServer interface { 288 | Send(*SimpleResponse) error 289 | Recv() (*SimpleRequest, error) 290 | grpc.ServerStream 291 | } 292 | 293 | type benchmarkServiceStreamingCallServer struct { 294 | grpc.ServerStream 295 | } 296 | 297 | func (x *benchmarkServiceStreamingCallServer) Send(m *SimpleResponse) error { 298 | return x.ServerStream.SendMsg(m) 299 | } 300 | 301 | func (x *benchmarkServiceStreamingCallServer) Recv() (*SimpleRequest, error) { 302 | m := new(SimpleRequest) 303 | if err := x.ServerStream.RecvMsg(m); err != nil { 304 | return nil, err 305 | } 306 | return m, nil 307 | } 308 | 309 | func _BenchmarkService_StreamingFromClient_Handler(srv interface{}, stream grpc.ServerStream) error { 310 | return srv.(BenchmarkServiceServer).StreamingFromClient(&benchmarkServiceStreamingFromClientServer{stream}) 311 | } 312 | 313 | type BenchmarkService_StreamingFromClientServer interface { 314 | SendAndClose(*SimpleResponse) error 315 | Recv() (*SimpleRequest, error) 316 | grpc.ServerStream 317 | } 318 | 319 | type benchmarkServiceStreamingFromClientServer struct { 320 | grpc.ServerStream 321 | } 322 | 323 | func (x *benchmarkServiceStreamingFromClientServer) SendAndClose(m *SimpleResponse) error { 324 | return x.ServerStream.SendMsg(m) 325 | } 326 | 327 | func (x *benchmarkServiceStreamingFromClientServer) Recv() (*SimpleRequest, error) { 328 | m := new(SimpleRequest) 329 | if err := x.ServerStream.RecvMsg(m); err != nil { 330 | return nil, err 331 | } 332 | return m, nil 333 | } 334 | 335 | func _BenchmarkService_StreamingFromServer_Handler(srv interface{}, stream grpc.ServerStream) error { 336 | m := new(SimpleRequest) 337 | if err := stream.RecvMsg(m); err != nil { 338 | return err 339 | } 340 | return srv.(BenchmarkServiceServer).StreamingFromServer(m, &benchmarkServiceStreamingFromServerServer{stream}) 341 | } 342 | 343 | type BenchmarkService_StreamingFromServerServer interface { 344 | Send(*SimpleResponse) error 345 | grpc.ServerStream 346 | } 347 | 348 | type benchmarkServiceStreamingFromServerServer struct { 349 | grpc.ServerStream 350 | } 351 | 352 | func (x *benchmarkServiceStreamingFromServerServer) Send(m *SimpleResponse) error { 353 | return x.ServerStream.SendMsg(m) 354 | } 355 | 356 | func _BenchmarkService_StreamingBothWays_Handler(srv interface{}, stream grpc.ServerStream) error { 357 | return srv.(BenchmarkServiceServer).StreamingBothWays(&benchmarkServiceStreamingBothWaysServer{stream}) 358 | } 359 | 360 | type BenchmarkService_StreamingBothWaysServer interface { 361 | Send(*SimpleResponse) error 362 | Recv() (*SimpleRequest, error) 363 | grpc.ServerStream 364 | } 365 | 366 | type benchmarkServiceStreamingBothWaysServer struct { 367 | grpc.ServerStream 368 | } 369 | 370 | func (x *benchmarkServiceStreamingBothWaysServer) Send(m *SimpleResponse) error { 371 | return x.ServerStream.SendMsg(m) 372 | } 373 | 374 | func (x *benchmarkServiceStreamingBothWaysServer) Recv() (*SimpleRequest, error) { 375 | m := new(SimpleRequest) 376 | if err := x.ServerStream.RecvMsg(m); err != nil { 377 | return nil, err 378 | } 379 | return m, nil 380 | } 381 | 382 | var _BenchmarkService_serviceDesc = grpc.ServiceDesc{ 383 | ServiceName: "grpc.testing.BenchmarkService", 384 | HandlerType: (*BenchmarkServiceServer)(nil), 385 | Methods: []grpc.MethodDesc{ 386 | { 387 | MethodName: "UnaryCall", 388 | Handler: _BenchmarkService_UnaryCall_Handler, 389 | }, 390 | }, 391 | Streams: []grpc.StreamDesc{ 392 | { 393 | StreamName: "StreamingCall", 394 | Handler: _BenchmarkService_StreamingCall_Handler, 395 | ServerStreams: true, 396 | ClientStreams: true, 397 | }, 398 | { 399 | StreamName: "StreamingFromClient", 400 | Handler: _BenchmarkService_StreamingFromClient_Handler, 401 | ClientStreams: true, 402 | }, 403 | { 404 | StreamName: "StreamingFromServer", 405 | Handler: _BenchmarkService_StreamingFromServer_Handler, 406 | ServerStreams: true, 407 | }, 408 | { 409 | StreamName: "StreamingBothWays", 410 | Handler: _BenchmarkService_StreamingBothWays_Handler, 411 | ServerStreams: true, 412 | ClientStreams: true, 413 | }, 414 | }, 415 | Metadata: "benchmark_service.proto", 416 | } 417 | -------------------------------------------------------------------------------- /GoGrpcClient/grpc_testing/messages.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // source: messages.proto 3 | 4 | package grpc_testing 5 | 6 | import ( 7 | fmt "fmt" 8 | proto "github.com/golang/protobuf/proto" 9 | math "math" 10 | ) 11 | 12 | // Reference imports to suppress errors if they are not otherwise used. 13 | var _ = proto.Marshal 14 | var _ = fmt.Errorf 15 | var _ = math.Inf 16 | 17 | // This is a compile-time assertion to ensure that this generated file 18 | // is compatible with the proto package it is being compiled against. 19 | // A compilation error at this line likely means your copy of the 20 | // proto package needs to be updated. 21 | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 22 | 23 | // The type of payload that should be returned. 24 | type PayloadType int32 25 | 26 | const ( 27 | // Compressable text format. 28 | PayloadType_COMPRESSABLE PayloadType = 0 29 | ) 30 | 31 | var PayloadType_name = map[int32]string{ 32 | 0: "COMPRESSABLE", 33 | } 34 | 35 | var PayloadType_value = map[string]int32{ 36 | "COMPRESSABLE": 0, 37 | } 38 | 39 | func (x PayloadType) String() string { 40 | return proto.EnumName(PayloadType_name, int32(x)) 41 | } 42 | 43 | func (PayloadType) EnumDescriptor() ([]byte, []int) { 44 | return fileDescriptor_4dc296cbfe5ffcd5, []int{0} 45 | } 46 | 47 | // The type of route that a client took to reach a server w.r.t. gRPCLB. 48 | // The server must fill in "fallback" if it detects that the RPC reached 49 | // the server via the "gRPCLB fallback" path, and "backend" if it detects 50 | // that the RPC reached the server via "gRPCLB backend" path (i.e. if it got 51 | // the address of this server from the gRPCLB server BalanceLoad RPC). Exactly 52 | // how this detection is done is context and server dependant. 53 | type GrpclbRouteType int32 54 | 55 | const ( 56 | // Server didn't detect the route that a client took to reach it. 57 | GrpclbRouteType_GRPCLB_ROUTE_TYPE_UNKNOWN GrpclbRouteType = 0 58 | // Indicates that a client reached a server via gRPCLB fallback. 59 | GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK GrpclbRouteType = 1 60 | // Indicates that a client reached a server as a gRPCLB-given backend. 61 | GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND GrpclbRouteType = 2 62 | ) 63 | 64 | var GrpclbRouteType_name = map[int32]string{ 65 | 0: "GRPCLB_ROUTE_TYPE_UNKNOWN", 66 | 1: "GRPCLB_ROUTE_TYPE_FALLBACK", 67 | 2: "GRPCLB_ROUTE_TYPE_BACKEND", 68 | } 69 | 70 | var GrpclbRouteType_value = map[string]int32{ 71 | "GRPCLB_ROUTE_TYPE_UNKNOWN": 0, 72 | "GRPCLB_ROUTE_TYPE_FALLBACK": 1, 73 | "GRPCLB_ROUTE_TYPE_BACKEND": 2, 74 | } 75 | 76 | func (x GrpclbRouteType) String() string { 77 | return proto.EnumName(GrpclbRouteType_name, int32(x)) 78 | } 79 | 80 | func (GrpclbRouteType) EnumDescriptor() ([]byte, []int) { 81 | return fileDescriptor_4dc296cbfe5ffcd5, []int{1} 82 | } 83 | 84 | // TODO(dgq): Go back to using well-known types once 85 | // https://github.com/grpc/grpc/issues/6980 has been fixed. 86 | // import "google/protobuf/wrappers.proto"; 87 | type BoolValue struct { 88 | // The bool value. 89 | Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` 90 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 91 | XXX_unrecognized []byte `json:"-"` 92 | XXX_sizecache int32 `json:"-"` 93 | } 94 | 95 | func (m *BoolValue) Reset() { *m = BoolValue{} } 96 | func (m *BoolValue) String() string { return proto.CompactTextString(m) } 97 | func (*BoolValue) ProtoMessage() {} 98 | func (*BoolValue) Descriptor() ([]byte, []int) { 99 | return fileDescriptor_4dc296cbfe5ffcd5, []int{0} 100 | } 101 | 102 | func (m *BoolValue) XXX_Unmarshal(b []byte) error { 103 | return xxx_messageInfo_BoolValue.Unmarshal(m, b) 104 | } 105 | func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 106 | return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) 107 | } 108 | func (m *BoolValue) XXX_Merge(src proto.Message) { 109 | xxx_messageInfo_BoolValue.Merge(m, src) 110 | } 111 | func (m *BoolValue) XXX_Size() int { 112 | return xxx_messageInfo_BoolValue.Size(m) 113 | } 114 | func (m *BoolValue) XXX_DiscardUnknown() { 115 | xxx_messageInfo_BoolValue.DiscardUnknown(m) 116 | } 117 | 118 | var xxx_messageInfo_BoolValue proto.InternalMessageInfo 119 | 120 | func (m *BoolValue) GetValue() bool { 121 | if m != nil { 122 | return m.Value 123 | } 124 | return false 125 | } 126 | 127 | // A block of data, to simply increase gRPC message size. 128 | type Payload struct { 129 | // The type of data in body. 130 | Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.testing.PayloadType" json:"type,omitempty"` 131 | // Primary contents of payload. 132 | Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` 133 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 134 | XXX_unrecognized []byte `json:"-"` 135 | XXX_sizecache int32 `json:"-"` 136 | } 137 | 138 | func (m *Payload) Reset() { *m = Payload{} } 139 | func (m *Payload) String() string { return proto.CompactTextString(m) } 140 | func (*Payload) ProtoMessage() {} 141 | func (*Payload) Descriptor() ([]byte, []int) { 142 | return fileDescriptor_4dc296cbfe5ffcd5, []int{1} 143 | } 144 | 145 | func (m *Payload) XXX_Unmarshal(b []byte) error { 146 | return xxx_messageInfo_Payload.Unmarshal(m, b) 147 | } 148 | func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 149 | return xxx_messageInfo_Payload.Marshal(b, m, deterministic) 150 | } 151 | func (m *Payload) XXX_Merge(src proto.Message) { 152 | xxx_messageInfo_Payload.Merge(m, src) 153 | } 154 | func (m *Payload) XXX_Size() int { 155 | return xxx_messageInfo_Payload.Size(m) 156 | } 157 | func (m *Payload) XXX_DiscardUnknown() { 158 | xxx_messageInfo_Payload.DiscardUnknown(m) 159 | } 160 | 161 | var xxx_messageInfo_Payload proto.InternalMessageInfo 162 | 163 | func (m *Payload) GetType() PayloadType { 164 | if m != nil { 165 | return m.Type 166 | } 167 | return PayloadType_COMPRESSABLE 168 | } 169 | 170 | func (m *Payload) GetBody() []byte { 171 | if m != nil { 172 | return m.Body 173 | } 174 | return nil 175 | } 176 | 177 | // A protobuf representation for grpc status. This is used by test 178 | // clients to specify a status that the server should attempt to return. 179 | type EchoStatus struct { 180 | Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` 181 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` 182 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 183 | XXX_unrecognized []byte `json:"-"` 184 | XXX_sizecache int32 `json:"-"` 185 | } 186 | 187 | func (m *EchoStatus) Reset() { *m = EchoStatus{} } 188 | func (m *EchoStatus) String() string { return proto.CompactTextString(m) } 189 | func (*EchoStatus) ProtoMessage() {} 190 | func (*EchoStatus) Descriptor() ([]byte, []int) { 191 | return fileDescriptor_4dc296cbfe5ffcd5, []int{2} 192 | } 193 | 194 | func (m *EchoStatus) XXX_Unmarshal(b []byte) error { 195 | return xxx_messageInfo_EchoStatus.Unmarshal(m, b) 196 | } 197 | func (m *EchoStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 198 | return xxx_messageInfo_EchoStatus.Marshal(b, m, deterministic) 199 | } 200 | func (m *EchoStatus) XXX_Merge(src proto.Message) { 201 | xxx_messageInfo_EchoStatus.Merge(m, src) 202 | } 203 | func (m *EchoStatus) XXX_Size() int { 204 | return xxx_messageInfo_EchoStatus.Size(m) 205 | } 206 | func (m *EchoStatus) XXX_DiscardUnknown() { 207 | xxx_messageInfo_EchoStatus.DiscardUnknown(m) 208 | } 209 | 210 | var xxx_messageInfo_EchoStatus proto.InternalMessageInfo 211 | 212 | func (m *EchoStatus) GetCode() int32 { 213 | if m != nil { 214 | return m.Code 215 | } 216 | return 0 217 | } 218 | 219 | func (m *EchoStatus) GetMessage() string { 220 | if m != nil { 221 | return m.Message 222 | } 223 | return "" 224 | } 225 | 226 | // Unary request. 227 | type SimpleRequest struct { 228 | // Desired payload type in the response from the server. 229 | // If response_type is RANDOM, server randomly chooses one from other formats. 230 | ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` 231 | // Desired payload size in the response from the server. 232 | ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"` 233 | // Optional input payload sent along with the request. 234 | Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` 235 | // Whether SimpleResponse should include username. 236 | FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"` 237 | // Whether SimpleResponse should include OAuth scope. 238 | FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"` 239 | // Whether to request the server to compress the response. This field is 240 | // "nullable" in order to interoperate seamlessly with clients not able to 241 | // implement the full compression tests by introspecting the call to verify 242 | // the response's compression status. 243 | ResponseCompressed *BoolValue `protobuf:"bytes,6,opt,name=response_compressed,json=responseCompressed,proto3" json:"response_compressed,omitempty"` 244 | // Whether server should return a given status 245 | ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` 246 | // Whether the server should expect this request to be compressed. 247 | ExpectCompressed *BoolValue `protobuf:"bytes,8,opt,name=expect_compressed,json=expectCompressed,proto3" json:"expect_compressed,omitempty"` 248 | // Whether SimpleResponse should include server_id. 249 | FillServerId bool `protobuf:"varint,9,opt,name=fill_server_id,json=fillServerId,proto3" json:"fill_server_id,omitempty"` 250 | // Whether SimpleResponse should include grpclb_route_type. 251 | FillGrpclbRouteType bool `protobuf:"varint,10,opt,name=fill_grpclb_route_type,json=fillGrpclbRouteType,proto3" json:"fill_grpclb_route_type,omitempty"` 252 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 253 | XXX_unrecognized []byte `json:"-"` 254 | XXX_sizecache int32 `json:"-"` 255 | } 256 | 257 | func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } 258 | func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } 259 | func (*SimpleRequest) ProtoMessage() {} 260 | func (*SimpleRequest) Descriptor() ([]byte, []int) { 261 | return fileDescriptor_4dc296cbfe5ffcd5, []int{3} 262 | } 263 | 264 | func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { 265 | return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) 266 | } 267 | func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 268 | return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) 269 | } 270 | func (m *SimpleRequest) XXX_Merge(src proto.Message) { 271 | xxx_messageInfo_SimpleRequest.Merge(m, src) 272 | } 273 | func (m *SimpleRequest) XXX_Size() int { 274 | return xxx_messageInfo_SimpleRequest.Size(m) 275 | } 276 | func (m *SimpleRequest) XXX_DiscardUnknown() { 277 | xxx_messageInfo_SimpleRequest.DiscardUnknown(m) 278 | } 279 | 280 | var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo 281 | 282 | func (m *SimpleRequest) GetResponseType() PayloadType { 283 | if m != nil { 284 | return m.ResponseType 285 | } 286 | return PayloadType_COMPRESSABLE 287 | } 288 | 289 | func (m *SimpleRequest) GetResponseSize() int32 { 290 | if m != nil { 291 | return m.ResponseSize 292 | } 293 | return 0 294 | } 295 | 296 | func (m *SimpleRequest) GetPayload() *Payload { 297 | if m != nil { 298 | return m.Payload 299 | } 300 | return nil 301 | } 302 | 303 | func (m *SimpleRequest) GetFillUsername() bool { 304 | if m != nil { 305 | return m.FillUsername 306 | } 307 | return false 308 | } 309 | 310 | func (m *SimpleRequest) GetFillOauthScope() bool { 311 | if m != nil { 312 | return m.FillOauthScope 313 | } 314 | return false 315 | } 316 | 317 | func (m *SimpleRequest) GetResponseCompressed() *BoolValue { 318 | if m != nil { 319 | return m.ResponseCompressed 320 | } 321 | return nil 322 | } 323 | 324 | func (m *SimpleRequest) GetResponseStatus() *EchoStatus { 325 | if m != nil { 326 | return m.ResponseStatus 327 | } 328 | return nil 329 | } 330 | 331 | func (m *SimpleRequest) GetExpectCompressed() *BoolValue { 332 | if m != nil { 333 | return m.ExpectCompressed 334 | } 335 | return nil 336 | } 337 | 338 | func (m *SimpleRequest) GetFillServerId() bool { 339 | if m != nil { 340 | return m.FillServerId 341 | } 342 | return false 343 | } 344 | 345 | func (m *SimpleRequest) GetFillGrpclbRouteType() bool { 346 | if m != nil { 347 | return m.FillGrpclbRouteType 348 | } 349 | return false 350 | } 351 | 352 | // Unary response, as configured by the request. 353 | type SimpleResponse struct { 354 | // Payload to increase message size. 355 | Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` 356 | // The user the request came from, for verifying authentication was 357 | // successful when the client expected it. 358 | Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` 359 | // OAuth scope. 360 | OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"` 361 | // Server ID. This must be unique among different server instances, 362 | // but the same across all RPC's made to a particular server instance. 363 | ServerId string `protobuf:"bytes,4,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` 364 | // gRPCLB Path. 365 | GrpclbRouteType GrpclbRouteType `protobuf:"varint,5,opt,name=grpclb_route_type,json=grpclbRouteType,proto3,enum=grpc.testing.GrpclbRouteType" json:"grpclb_route_type,omitempty"` 366 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 367 | XXX_unrecognized []byte `json:"-"` 368 | XXX_sizecache int32 `json:"-"` 369 | } 370 | 371 | func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } 372 | func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } 373 | func (*SimpleResponse) ProtoMessage() {} 374 | func (*SimpleResponse) Descriptor() ([]byte, []int) { 375 | return fileDescriptor_4dc296cbfe5ffcd5, []int{4} 376 | } 377 | 378 | func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { 379 | return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) 380 | } 381 | func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 382 | return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) 383 | } 384 | func (m *SimpleResponse) XXX_Merge(src proto.Message) { 385 | xxx_messageInfo_SimpleResponse.Merge(m, src) 386 | } 387 | func (m *SimpleResponse) XXX_Size() int { 388 | return xxx_messageInfo_SimpleResponse.Size(m) 389 | } 390 | func (m *SimpleResponse) XXX_DiscardUnknown() { 391 | xxx_messageInfo_SimpleResponse.DiscardUnknown(m) 392 | } 393 | 394 | var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo 395 | 396 | func (m *SimpleResponse) GetPayload() *Payload { 397 | if m != nil { 398 | return m.Payload 399 | } 400 | return nil 401 | } 402 | 403 | func (m *SimpleResponse) GetUsername() string { 404 | if m != nil { 405 | return m.Username 406 | } 407 | return "" 408 | } 409 | 410 | func (m *SimpleResponse) GetOauthScope() string { 411 | if m != nil { 412 | return m.OauthScope 413 | } 414 | return "" 415 | } 416 | 417 | func (m *SimpleResponse) GetServerId() string { 418 | if m != nil { 419 | return m.ServerId 420 | } 421 | return "" 422 | } 423 | 424 | func (m *SimpleResponse) GetGrpclbRouteType() GrpclbRouteType { 425 | if m != nil { 426 | return m.GrpclbRouteType 427 | } 428 | return GrpclbRouteType_GRPCLB_ROUTE_TYPE_UNKNOWN 429 | } 430 | 431 | // Client-streaming request. 432 | type StreamingInputCallRequest struct { 433 | // Optional input payload sent along with the request. 434 | Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` 435 | // Whether the server should expect this request to be compressed. This field 436 | // is "nullable" in order to interoperate seamlessly with servers not able to 437 | // implement the full compression tests by introspecting the call to verify 438 | // the request's compression status. 439 | ExpectCompressed *BoolValue `protobuf:"bytes,2,opt,name=expect_compressed,json=expectCompressed,proto3" json:"expect_compressed,omitempty"` 440 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 441 | XXX_unrecognized []byte `json:"-"` 442 | XXX_sizecache int32 `json:"-"` 443 | } 444 | 445 | func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} } 446 | func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } 447 | func (*StreamingInputCallRequest) ProtoMessage() {} 448 | func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { 449 | return fileDescriptor_4dc296cbfe5ffcd5, []int{5} 450 | } 451 | 452 | func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { 453 | return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) 454 | } 455 | func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 456 | return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) 457 | } 458 | func (m *StreamingInputCallRequest) XXX_Merge(src proto.Message) { 459 | xxx_messageInfo_StreamingInputCallRequest.Merge(m, src) 460 | } 461 | func (m *StreamingInputCallRequest) XXX_Size() int { 462 | return xxx_messageInfo_StreamingInputCallRequest.Size(m) 463 | } 464 | func (m *StreamingInputCallRequest) XXX_DiscardUnknown() { 465 | xxx_messageInfo_StreamingInputCallRequest.DiscardUnknown(m) 466 | } 467 | 468 | var xxx_messageInfo_StreamingInputCallRequest proto.InternalMessageInfo 469 | 470 | func (m *StreamingInputCallRequest) GetPayload() *Payload { 471 | if m != nil { 472 | return m.Payload 473 | } 474 | return nil 475 | } 476 | 477 | func (m *StreamingInputCallRequest) GetExpectCompressed() *BoolValue { 478 | if m != nil { 479 | return m.ExpectCompressed 480 | } 481 | return nil 482 | } 483 | 484 | // Client-streaming response. 485 | type StreamingInputCallResponse struct { 486 | // Aggregated size of payloads received from the client. 487 | AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize,proto3" json:"aggregated_payload_size,omitempty"` 488 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 489 | XXX_unrecognized []byte `json:"-"` 490 | XXX_sizecache int32 `json:"-"` 491 | } 492 | 493 | func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} } 494 | func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } 495 | func (*StreamingInputCallResponse) ProtoMessage() {} 496 | func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { 497 | return fileDescriptor_4dc296cbfe5ffcd5, []int{6} 498 | } 499 | 500 | func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { 501 | return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) 502 | } 503 | func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 504 | return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) 505 | } 506 | func (m *StreamingInputCallResponse) XXX_Merge(src proto.Message) { 507 | xxx_messageInfo_StreamingInputCallResponse.Merge(m, src) 508 | } 509 | func (m *StreamingInputCallResponse) XXX_Size() int { 510 | return xxx_messageInfo_StreamingInputCallResponse.Size(m) 511 | } 512 | func (m *StreamingInputCallResponse) XXX_DiscardUnknown() { 513 | xxx_messageInfo_StreamingInputCallResponse.DiscardUnknown(m) 514 | } 515 | 516 | var xxx_messageInfo_StreamingInputCallResponse proto.InternalMessageInfo 517 | 518 | func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 { 519 | if m != nil { 520 | return m.AggregatedPayloadSize 521 | } 522 | return 0 523 | } 524 | 525 | // Configuration for a particular response. 526 | type ResponseParameters struct { 527 | // Desired payload sizes in responses from the server. 528 | Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` 529 | // Desired interval between consecutive responses in the response stream in 530 | // microseconds. 531 | IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"` 532 | // Whether to request the server to compress the response. This field is 533 | // "nullable" in order to interoperate seamlessly with clients not able to 534 | // implement the full compression tests by introspecting the call to verify 535 | // the response's compression status. 536 | Compressed *BoolValue `protobuf:"bytes,3,opt,name=compressed,proto3" json:"compressed,omitempty"` 537 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 538 | XXX_unrecognized []byte `json:"-"` 539 | XXX_sizecache int32 `json:"-"` 540 | } 541 | 542 | func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } 543 | func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } 544 | func (*ResponseParameters) ProtoMessage() {} 545 | func (*ResponseParameters) Descriptor() ([]byte, []int) { 546 | return fileDescriptor_4dc296cbfe5ffcd5, []int{7} 547 | } 548 | 549 | func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { 550 | return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) 551 | } 552 | func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 553 | return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) 554 | } 555 | func (m *ResponseParameters) XXX_Merge(src proto.Message) { 556 | xxx_messageInfo_ResponseParameters.Merge(m, src) 557 | } 558 | func (m *ResponseParameters) XXX_Size() int { 559 | return xxx_messageInfo_ResponseParameters.Size(m) 560 | } 561 | func (m *ResponseParameters) XXX_DiscardUnknown() { 562 | xxx_messageInfo_ResponseParameters.DiscardUnknown(m) 563 | } 564 | 565 | var xxx_messageInfo_ResponseParameters proto.InternalMessageInfo 566 | 567 | func (m *ResponseParameters) GetSize() int32 { 568 | if m != nil { 569 | return m.Size 570 | } 571 | return 0 572 | } 573 | 574 | func (m *ResponseParameters) GetIntervalUs() int32 { 575 | if m != nil { 576 | return m.IntervalUs 577 | } 578 | return 0 579 | } 580 | 581 | func (m *ResponseParameters) GetCompressed() *BoolValue { 582 | if m != nil { 583 | return m.Compressed 584 | } 585 | return nil 586 | } 587 | 588 | // Server-streaming request. 589 | type StreamingOutputCallRequest struct { 590 | // Desired payload type in the response from the server. 591 | // If response_type is RANDOM, the payload from each response in the stream 592 | // might be of different types. This is to simulate a mixed type of payload 593 | // stream. 594 | ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"` 595 | // Configuration for each expected response message. 596 | ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"` 597 | // Optional input payload sent along with the request. 598 | Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` 599 | // Whether server should return a given status 600 | ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` 601 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 602 | XXX_unrecognized []byte `json:"-"` 603 | XXX_sizecache int32 `json:"-"` 604 | } 605 | 606 | func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} } 607 | func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } 608 | func (*StreamingOutputCallRequest) ProtoMessage() {} 609 | func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { 610 | return fileDescriptor_4dc296cbfe5ffcd5, []int{8} 611 | } 612 | 613 | func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { 614 | return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) 615 | } 616 | func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 617 | return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) 618 | } 619 | func (m *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { 620 | xxx_messageInfo_StreamingOutputCallRequest.Merge(m, src) 621 | } 622 | func (m *StreamingOutputCallRequest) XXX_Size() int { 623 | return xxx_messageInfo_StreamingOutputCallRequest.Size(m) 624 | } 625 | func (m *StreamingOutputCallRequest) XXX_DiscardUnknown() { 626 | xxx_messageInfo_StreamingOutputCallRequest.DiscardUnknown(m) 627 | } 628 | 629 | var xxx_messageInfo_StreamingOutputCallRequest proto.InternalMessageInfo 630 | 631 | func (m *StreamingOutputCallRequest) GetResponseType() PayloadType { 632 | if m != nil { 633 | return m.ResponseType 634 | } 635 | return PayloadType_COMPRESSABLE 636 | } 637 | 638 | func (m *StreamingOutputCallRequest) GetResponseParameters() []*ResponseParameters { 639 | if m != nil { 640 | return m.ResponseParameters 641 | } 642 | return nil 643 | } 644 | 645 | func (m *StreamingOutputCallRequest) GetPayload() *Payload { 646 | if m != nil { 647 | return m.Payload 648 | } 649 | return nil 650 | } 651 | 652 | func (m *StreamingOutputCallRequest) GetResponseStatus() *EchoStatus { 653 | if m != nil { 654 | return m.ResponseStatus 655 | } 656 | return nil 657 | } 658 | 659 | // Server-streaming response, as configured by the request and parameters. 660 | type StreamingOutputCallResponse struct { 661 | // Payload to increase response size. 662 | Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` 663 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 664 | XXX_unrecognized []byte `json:"-"` 665 | XXX_sizecache int32 `json:"-"` 666 | } 667 | 668 | func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} } 669 | func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } 670 | func (*StreamingOutputCallResponse) ProtoMessage() {} 671 | func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { 672 | return fileDescriptor_4dc296cbfe5ffcd5, []int{9} 673 | } 674 | 675 | func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { 676 | return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) 677 | } 678 | func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 679 | return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) 680 | } 681 | func (m *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { 682 | xxx_messageInfo_StreamingOutputCallResponse.Merge(m, src) 683 | } 684 | func (m *StreamingOutputCallResponse) XXX_Size() int { 685 | return xxx_messageInfo_StreamingOutputCallResponse.Size(m) 686 | } 687 | func (m *StreamingOutputCallResponse) XXX_DiscardUnknown() { 688 | xxx_messageInfo_StreamingOutputCallResponse.DiscardUnknown(m) 689 | } 690 | 691 | var xxx_messageInfo_StreamingOutputCallResponse proto.InternalMessageInfo 692 | 693 | func (m *StreamingOutputCallResponse) GetPayload() *Payload { 694 | if m != nil { 695 | return m.Payload 696 | } 697 | return nil 698 | } 699 | 700 | // For reconnect interop test only. 701 | // Client tells server what reconnection parameters it used. 702 | type ReconnectParams struct { 703 | MaxReconnectBackoffMs int32 `protobuf:"varint,1,opt,name=max_reconnect_backoff_ms,json=maxReconnectBackoffMs,proto3" json:"max_reconnect_backoff_ms,omitempty"` 704 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 705 | XXX_unrecognized []byte `json:"-"` 706 | XXX_sizecache int32 `json:"-"` 707 | } 708 | 709 | func (m *ReconnectParams) Reset() { *m = ReconnectParams{} } 710 | func (m *ReconnectParams) String() string { return proto.CompactTextString(m) } 711 | func (*ReconnectParams) ProtoMessage() {} 712 | func (*ReconnectParams) Descriptor() ([]byte, []int) { 713 | return fileDescriptor_4dc296cbfe5ffcd5, []int{10} 714 | } 715 | 716 | func (m *ReconnectParams) XXX_Unmarshal(b []byte) error { 717 | return xxx_messageInfo_ReconnectParams.Unmarshal(m, b) 718 | } 719 | func (m *ReconnectParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 720 | return xxx_messageInfo_ReconnectParams.Marshal(b, m, deterministic) 721 | } 722 | func (m *ReconnectParams) XXX_Merge(src proto.Message) { 723 | xxx_messageInfo_ReconnectParams.Merge(m, src) 724 | } 725 | func (m *ReconnectParams) XXX_Size() int { 726 | return xxx_messageInfo_ReconnectParams.Size(m) 727 | } 728 | func (m *ReconnectParams) XXX_DiscardUnknown() { 729 | xxx_messageInfo_ReconnectParams.DiscardUnknown(m) 730 | } 731 | 732 | var xxx_messageInfo_ReconnectParams proto.InternalMessageInfo 733 | 734 | func (m *ReconnectParams) GetMaxReconnectBackoffMs() int32 { 735 | if m != nil { 736 | return m.MaxReconnectBackoffMs 737 | } 738 | return 0 739 | } 740 | 741 | // For reconnect interop test only. 742 | // Server tells client whether its reconnects are following the spec and the 743 | // reconnect backoffs it saw. 744 | type ReconnectInfo struct { 745 | Passed bool `protobuf:"varint,1,opt,name=passed,proto3" json:"passed,omitempty"` 746 | BackoffMs []int32 `protobuf:"varint,2,rep,packed,name=backoff_ms,json=backoffMs,proto3" json:"backoff_ms,omitempty"` 747 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 748 | XXX_unrecognized []byte `json:"-"` 749 | XXX_sizecache int32 `json:"-"` 750 | } 751 | 752 | func (m *ReconnectInfo) Reset() { *m = ReconnectInfo{} } 753 | func (m *ReconnectInfo) String() string { return proto.CompactTextString(m) } 754 | func (*ReconnectInfo) ProtoMessage() {} 755 | func (*ReconnectInfo) Descriptor() ([]byte, []int) { 756 | return fileDescriptor_4dc296cbfe5ffcd5, []int{11} 757 | } 758 | 759 | func (m *ReconnectInfo) XXX_Unmarshal(b []byte) error { 760 | return xxx_messageInfo_ReconnectInfo.Unmarshal(m, b) 761 | } 762 | func (m *ReconnectInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 763 | return xxx_messageInfo_ReconnectInfo.Marshal(b, m, deterministic) 764 | } 765 | func (m *ReconnectInfo) XXX_Merge(src proto.Message) { 766 | xxx_messageInfo_ReconnectInfo.Merge(m, src) 767 | } 768 | func (m *ReconnectInfo) XXX_Size() int { 769 | return xxx_messageInfo_ReconnectInfo.Size(m) 770 | } 771 | func (m *ReconnectInfo) XXX_DiscardUnknown() { 772 | xxx_messageInfo_ReconnectInfo.DiscardUnknown(m) 773 | } 774 | 775 | var xxx_messageInfo_ReconnectInfo proto.InternalMessageInfo 776 | 777 | func (m *ReconnectInfo) GetPassed() bool { 778 | if m != nil { 779 | return m.Passed 780 | } 781 | return false 782 | } 783 | 784 | func (m *ReconnectInfo) GetBackoffMs() []int32 { 785 | if m != nil { 786 | return m.BackoffMs 787 | } 788 | return nil 789 | } 790 | 791 | func init() { 792 | proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) 793 | proto.RegisterEnum("grpc.testing.GrpclbRouteType", GrpclbRouteType_name, GrpclbRouteType_value) 794 | proto.RegisterType((*BoolValue)(nil), "grpc.testing.BoolValue") 795 | proto.RegisterType((*Payload)(nil), "grpc.testing.Payload") 796 | proto.RegisterType((*EchoStatus)(nil), "grpc.testing.EchoStatus") 797 | proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") 798 | proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") 799 | proto.RegisterType((*StreamingInputCallRequest)(nil), "grpc.testing.StreamingInputCallRequest") 800 | proto.RegisterType((*StreamingInputCallResponse)(nil), "grpc.testing.StreamingInputCallResponse") 801 | proto.RegisterType((*ResponseParameters)(nil), "grpc.testing.ResponseParameters") 802 | proto.RegisterType((*StreamingOutputCallRequest)(nil), "grpc.testing.StreamingOutputCallRequest") 803 | proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse") 804 | proto.RegisterType((*ReconnectParams)(nil), "grpc.testing.ReconnectParams") 805 | proto.RegisterType((*ReconnectInfo)(nil), "grpc.testing.ReconnectInfo") 806 | } 807 | 808 | func init() { proto.RegisterFile("messages.proto", fileDescriptor_4dc296cbfe5ffcd5) } 809 | 810 | var fileDescriptor_4dc296cbfe5ffcd5 = []byte{ 811 | // 794 bytes of a gzipped FileDescriptorProto 812 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xdd, 0x6e, 0xdb, 0x36, 813 | 0x18, 0xad, 0x1c, 0x3b, 0x89, 0xbf, 0x38, 0x8e, 0xcb, 0xae, 0xad, 0x92, 0x22, 0xab, 0xa7, 0xed, 814 | 0xc2, 0x28, 0x30, 0x0f, 0x48, 0x81, 0x0d, 0xd8, 0xc5, 0x00, 0xdb, 0x75, 0x3b, 0xaf, 0xae, 0xed, 815 | 0x51, 0xf6, 0x86, 0x5d, 0x09, 0xb4, 0x4c, 0xab, 0xc2, 0x24, 0x51, 0x13, 0xa9, 0x20, 0xee, 0xe5, 816 | 0x1e, 0x61, 0x8f, 0xb0, 0xbd, 0xdb, 0x9e, 0x63, 0x20, 0xf5, 0x6b, 0xc7, 0x28, 0x9a, 0xe5, 0x8e, 817 | 0xfc, 0x7e, 0x8e, 0xce, 0xe1, 0xe1, 0x47, 0x41, 0xd3, 0xa7, 0x9c, 0x13, 0x87, 0xf2, 0x6e, 0x18, 818 | 0x31, 0xc1, 0x50, 0xc3, 0x89, 0x42, 0xbb, 0x2b, 0x28, 0x17, 0x6e, 0xe0, 0x18, 0x5f, 0x40, 0xbd, 819 | 0xcf, 0x98, 0xf7, 0x0b, 0xf1, 0x62, 0x8a, 0x3e, 0x83, 0xda, 0xb5, 0x5c, 0xe8, 0x5a, 0x5b, 0xeb, 820 | 0x1c, 0xe3, 0x64, 0x63, 0x8c, 0xe1, 0x68, 0x46, 0x36, 0x1e, 0x23, 0x2b, 0xf4, 0x35, 0x54, 0xc5, 821 | 0x26, 0x4c, 0xf2, 0xcd, 0xab, 0xf3, 0x6e, 0x19, 0xaa, 0x9b, 0x16, 0xcd, 0x37, 0x21, 0xc5, 0xaa, 822 | 0x0c, 0x21, 0xa8, 0x2e, 0xd9, 0x6a, 0xa3, 0x57, 0xda, 0x5a, 0xa7, 0x81, 0xd5, 0xda, 0xf8, 0x1e, 823 | 0x60, 0x68, 0xbf, 0x67, 0xa6, 0x20, 0x22, 0xe6, 0xb2, 0xc2, 0x66, 0xab, 0x04, 0xb0, 0x86, 0xd5, 824 | 0x1a, 0xe9, 0x70, 0x94, 0x52, 0x56, 0x8d, 0x75, 0x9c, 0x6d, 0x8d, 0xbf, 0xab, 0x70, 0x6a, 0xba, 825 | 0x7e, 0xe8, 0x51, 0x4c, 0xff, 0x88, 0x29, 0x17, 0xe8, 0x07, 0x38, 0x8d, 0x28, 0x0f, 0x59, 0xc0, 826 | 0xa9, 0xf5, 0x69, 0xcc, 0x1a, 0x59, 0xbd, 0xdc, 0xa1, 0x2f, 0x4b, 0xfd, 0xdc, 0xfd, 0x90, 0x7c, 827 | 0xb1, 0x56, 0x14, 0x99, 0xee, 0x07, 0x8a, 0xbe, 0x81, 0xa3, 0x30, 0x41, 0xd0, 0x0f, 0xda, 0x5a, 828 | 0xe7, 0xe4, 0xea, 0xf1, 0x5e, 0x78, 0x9c, 0x55, 0x49, 0xd4, 0xb5, 0xeb, 0x79, 0x56, 0xcc, 0x69, 829 | 0x14, 0x10, 0x9f, 0xea, 0x55, 0x75, 0x9e, 0x0d, 0x19, 0x5c, 0xa4, 0x31, 0xd4, 0x81, 0x96, 0x2a, 830 | 0x62, 0x24, 0x16, 0xef, 0x2d, 0x6e, 0xb3, 0x90, 0xea, 0x35, 0x55, 0xd7, 0x94, 0xf1, 0xa9, 0x0c, 831 | 0x9b, 0x32, 0x8a, 0x7e, 0x84, 0x47, 0x39, 0x49, 0x9b, 0xf9, 0x61, 0x44, 0x39, 0xa7, 0x2b, 0xfd, 832 | 0x50, 0x71, 0x79, 0xba, 0xcd, 0x25, 0x37, 0x13, 0xa3, 0xac, 0x67, 0x90, 0xb7, 0xa0, 0x1e, 0x9c, 833 | 0x15, 0x72, 0x95, 0x03, 0xfa, 0x91, 0x42, 0xd1, 0xb7, 0x51, 0x0a, 0x87, 0x70, 0x33, 0x3f, 0x8a, 834 | 0xc4, 0xb1, 0x57, 0xf0, 0x90, 0xde, 0x84, 0xd4, 0x16, 0x65, 0x2a, 0xc7, 0x1f, 0xa7, 0xd2, 0x4a, 835 | 0x3a, 0x4a, 0x44, 0xbe, 0x02, 0x25, 0xd2, 0xe2, 0x34, 0xba, 0xa6, 0x91, 0xe5, 0xae, 0xf4, 0x7a, 836 | 0x71, 0x44, 0xa6, 0x0a, 0x8e, 0x56, 0xe8, 0x25, 0x3c, 0x51, 0x55, 0x12, 0xd6, 0x5b, 0x5a, 0x11, 837 | 0x8b, 0x45, 0x6a, 0x33, 0xa8, 0xea, 0x47, 0x32, 0xfb, 0x46, 0x25, 0xb1, 0xcc, 0x49, 0x4b, 0x8d, 838 | 0x7f, 0x35, 0x68, 0x66, 0x97, 0x24, 0x61, 0x5e, 0x36, 0x50, 0xfb, 0x24, 0x03, 0x2f, 0xe0, 0x38, 839 | 0xf7, 0x2e, 0xb9, 0x83, 0xf9, 0x1e, 0x3d, 0x87, 0x93, 0xb2, 0x65, 0x07, 0x2a, 0x0d, 0xac, 0xb0, 840 | 0xeb, 0x19, 0xd4, 0x0b, 0x59, 0xd5, 0xa4, 0x9b, 0x67, 0x92, 0x46, 0xf0, 0xf0, 0xb6, 0x9a, 0x9a, 841 | 0xba, 0xb4, 0x97, 0xdb, 0xa4, 0x76, 0x74, 0xe1, 0x33, 0x67, 0x47, 0xe8, 0x5f, 0x1a, 0x9c, 0x9b, 842 | 0x22, 0xa2, 0xc4, 0x77, 0x03, 0x67, 0x14, 0x84, 0xb1, 0x18, 0x10, 0xcf, 0xcb, 0x26, 0xe3, 0xce, 843 | 0x9a, 0xf7, 0x1a, 0x5b, 0xb9, 0xa3, 0xb1, 0xc6, 0x1c, 0x2e, 0xf6, 0x71, 0x4a, 0x8d, 0xf8, 0x16, 844 | 0x9e, 0x12, 0xc7, 0x89, 0xa8, 0x43, 0x04, 0x5d, 0x59, 0xe9, 0x97, 0x93, 0xc1, 0x4b, 0x5e, 0x80, 845 | 0xc7, 0x45, 0x3a, 0x25, 0x28, 0x27, 0xd0, 0xf8, 0x53, 0x03, 0x94, 0x81, 0xcc, 0x48, 0x44, 0x7c, 846 | 0x2a, 0x68, 0xa4, 0x5e, 0x8f, 0x52, 0xaf, 0x5a, 0x4b, 0x7b, 0xdc, 0x40, 0xd0, 0xe8, 0x9a, 0xc8, 847 | 0xf9, 0x4b, 0xe7, 0x19, 0xb2, 0xd0, 0x82, 0xa3, 0xef, 0x00, 0x4a, 0x02, 0x0f, 0x3e, 0x2e, 0xb0, 848 | 0x54, 0x6a, 0xfc, 0x53, 0x29, 0x69, 0x9b, 0xc6, 0x62, 0xe7, 0xc0, 0xef, 0xfb, 0x14, 0xfd, 0x5c, 849 | 0x9a, 0xf2, 0x30, 0xd7, 0xa8, 0x57, 0xda, 0x07, 0x9d, 0x93, 0xab, 0xf6, 0x36, 0xca, 0xed, 0xb3, 850 | 0x28, 0xc6, 0xbd, 0x74, 0x3e, 0x77, 0x7e, 0xb8, 0xee, 0xff, 0x3e, 0x18, 0x13, 0x78, 0xb6, 0xf7, 851 | 0x90, 0xfe, 0xe7, 0x28, 0x1a, 0x3f, 0xc1, 0x19, 0xa6, 0x36, 0x0b, 0x02, 0x6a, 0x0b, 0x25, 0x4d, 852 | 0x3a, 0xa8, 0xfb, 0xe4, 0xc6, 0x8a, 0xb2, 0xb0, 0xb5, 0x24, 0xf6, 0xef, 0x6c, 0xbd, 0xb6, 0x7c, 853 | 0x9e, 0x5d, 0x23, 0x9f, 0xdc, 0xe4, 0x5d, 0xfd, 0x24, 0xfb, 0x8e, 0x1b, 0xaf, 0xe1, 0x34, 0x8f, 854 | 0x8e, 0x82, 0x35, 0x43, 0x4f, 0xe0, 0x30, 0x24, 0xea, 0x1e, 0x24, 0x7f, 0xbc, 0x74, 0x87, 0x2e, 855 | 0x01, 0x4a, 0x98, 0xd2, 0x82, 0x1a, 0xae, 0x2f, 0x33, 0x9c, 0x17, 0xcf, 0xe1, 0xa4, 0xe4, 0x23, 856 | 0x6a, 0x41, 0x63, 0x30, 0x7d, 0x37, 0xc3, 0x43, 0xd3, 0xec, 0xf5, 0xc7, 0xc3, 0xd6, 0x83, 0x17, 857 | 0x0c, 0xce, 0x76, 0xc6, 0x17, 0x5d, 0xc2, 0xf9, 0x1b, 0x3c, 0x1b, 0x8c, 0xfb, 0x16, 0x9e, 0x2e, 858 | 0xe6, 0x43, 0x6b, 0xfe, 0xdb, 0x6c, 0x68, 0x2d, 0x26, 0x6f, 0x27, 0xd3, 0x5f, 0x27, 0xad, 0x07, 859 | 0xe8, 0x73, 0xb8, 0xb8, 0x9d, 0x7e, 0xdd, 0x1b, 0x8f, 0xfb, 0xbd, 0xc1, 0xdb, 0x96, 0xb6, 0xbf, 860 | 0x5d, 0xe6, 0x86, 0x93, 0x57, 0xad, 0xca, 0xf2, 0x50, 0xfd, 0xdb, 0x5f, 0xfe, 0x17, 0x00, 0x00, 861 | 0xff, 0xff, 0x16, 0x4e, 0xa0, 0xe5, 0xed, 0x07, 0x00, 0x00, 862 | } 863 | -------------------------------------------------------------------------------- /GoGrpcClient/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "flag" 6 | "fmt" 7 | "log" 8 | "math" 9 | "os" 10 | "sync" 11 | "time" 12 | 13 | "google.golang.org/grpc" 14 | "google.golang.org/grpc/credentials" 15 | 16 | testpb "github.com/grpc/grpc-dotnet/grpc_testing" 17 | ) 18 | 19 | var ( 20 | tls = flag.Bool("tls", false, "Connection uses TLS if true, else plain TCP") 21 | caFile = flag.String("ca_file", "", "The file containing the CA root cert file") 22 | serverAddr = flag.String("server_addr", "localhost:5000", "The server address in the format of host:port") 23 | serverHostOverride = flag.String("server_host_override", "x.test.youtube.com", "The server name used to verify the hostname returned by the TLS handshake") 24 | scenario = flag.String("scenario", "unary", "The scenario to run") 25 | requestSize = flag.Int("request_size", 0, "Request payload size") 26 | responseSize = flag.Int("response_size", 0, "Response payload size") 27 | connectionCount = flag.Int("connections", 1, "HTTP/2 connections") 28 | streams = flag.Int("streams", 1, "Streams per connection") 29 | warmup = flag.Int("warmup", 5, "Warmup in seconds") 30 | duration = flag.Int("duration", 10, "Duration in seconds") 31 | wg sync.WaitGroup 32 | connections []*grpc.ClientConn 33 | connectionLocks []sync.Mutex 34 | requestsPerConnection []int 35 | failuresPerConnection []int 36 | latencyPerConnection []latency 37 | stopped bool 38 | warmingUp bool 39 | ) 40 | 41 | type latency struct { 42 | count int 43 | sum float64 44 | } 45 | 46 | func main() { 47 | flag.Parse() 48 | 49 | fmt.Println("Args:", os.Args) 50 | 51 | var opts []grpc.DialOption 52 | if *tls { 53 | if *caFile == "" { 54 | log.Fatal("ca_file required with TLS") 55 | return 56 | } 57 | creds, err := credentials.NewClientTLSFromFile(*caFile, *serverHostOverride) 58 | if err != nil { 59 | log.Fatalf("Failed to create TLS credentials %v", err) 60 | } 61 | opts = append(opts, grpc.WithTransportCredentials(creds)) 62 | } else { 63 | opts = append(opts, grpc.WithInsecure()) 64 | } 65 | 66 | opts = append(opts, grpc.WithBlock()) 67 | 68 | buildConnections(context.Background(), opts) 69 | 70 | go func() { 71 | warmingUp = true 72 | time.Sleep(time.Duration(*warmup) * time.Second) 73 | warmingUp = false 74 | log.Print("Finished warming up") 75 | time.Sleep(time.Duration(*duration) * time.Second) 76 | stopped = true 77 | }() 78 | 79 | for connectionID, cc := range connections { 80 | runWithConn(connectionID, cc) 81 | } 82 | wg.Wait() 83 | 84 | calculateRequestStatistics() 85 | calculateLatencyStatistics() 86 | } 87 | 88 | func calculateRequestStatistics() { 89 | totalRequests := 0 90 | min := math.MaxInt32 91 | max := 0 92 | for connectionID := range connections { 93 | connectionRequests := requestsPerConnection[connectionID] 94 | totalRequests += connectionRequests 95 | 96 | if connectionRequests > max { 97 | max = connectionRequests 98 | } 99 | if connectionRequests < min { 100 | min = connectionRequests 101 | } 102 | } 103 | 104 | rps := totalRequests / int(*duration) 105 | log.Printf("Least Requests per Connection: %d", min) 106 | log.Printf("Most Requests per Connection: %d", max) 107 | log.Printf("RPS %d", rps) 108 | } 109 | 110 | func calculateLatencyStatistics() { 111 | totalRequests := 0 112 | totalSum := float64(0) 113 | for connectionID := range connections { 114 | latency := latencyPerConnection[connectionID] 115 | totalRequests += latency.count 116 | totalSum += latency.sum 117 | } 118 | if totalRequests > 0 { 119 | totalSum = totalSum / float64(totalRequests) 120 | } 121 | 122 | log.Printf("Average latency %fms", totalSum) 123 | } 124 | 125 | func runWithConn(connectionID int, cc *grpc.ClientConn) { 126 | for i := 0; i < *streams; i++ { 127 | streamID := i 128 | wg.Add(1) 129 | go func() { 130 | defer wg.Done() 131 | caller := makeCaller(cc, connectionID, streamID) 132 | log.Printf("Starting %d %d", connectionID, streamID) 133 | caller() 134 | log.Printf("Finished %d %d", connectionID, streamID) 135 | }() 136 | } 137 | } 138 | 139 | func makeCaller(cc *grpc.ClientConn, connectionID int, streamID int) func() { 140 | client := testpb.NewBenchmarkServiceClient(cc) 141 | if *scenario != "unary" { 142 | log.Fatalf("Unsupported scenario: %s", *scenario) 143 | } 144 | return func() { 145 | for { 146 | request := &testpb.SimpleRequest{ 147 | Payload: NewPayload(int(*requestSize)), 148 | ResponseSize: int32(*responseSize), 149 | } 150 | 151 | start := time.Now() 152 | _, err := client.UnaryCall(context.Background(), request) 153 | end := time.Now() 154 | 155 | if err != nil { 156 | handleFailure(connectionID) 157 | } else { 158 | handleSuccess(connectionID, start, end) 159 | } 160 | 161 | if stopped { 162 | return 163 | } 164 | } 165 | } 166 | } 167 | 168 | func handleFailure(connectionID int) { 169 | if stopped || warmingUp { 170 | return 171 | } 172 | connectionLocks[connectionID].Lock() 173 | failuresPerConnection[connectionID]++ 174 | connectionLocks[connectionID].Unlock() 175 | } 176 | 177 | func handleSuccess(connectionID int, start time.Time, end time.Time) { 178 | if stopped || warmingUp { 179 | return 180 | } 181 | connectionLocks[connectionID].Lock() 182 | requestsPerConnection[connectionID]++ 183 | 184 | count := latencyPerConnection[connectionID].count 185 | sum := latencyPerConnection[connectionID].sum 186 | 187 | callLatency := end.Sub(start) 188 | 189 | count++ 190 | sum += float64(callLatency.Nanoseconds()) / float64(1000*1000) 191 | 192 | latencyPerConnection[connectionID] = latency{ 193 | count: count, 194 | sum: sum, 195 | } 196 | connectionLocks[connectionID].Unlock() 197 | } 198 | 199 | func buildConnections(ctx context.Context, opts []grpc.DialOption) { 200 | connections = make([]*grpc.ClientConn, *connectionCount) 201 | connectionLocks = make([]sync.Mutex, *connectionCount) 202 | requestsPerConnection = make([]int, *connectionCount) 203 | failuresPerConnection = make([]int, *connectionCount) 204 | latencyPerConnection = make([]latency, *connectionCount) 205 | for i := range connections { 206 | conn, err := grpc.Dial(*serverAddr, opts...) 207 | if err != nil { 208 | log.Fatalf("fail to dial: %v", err) 209 | } 210 | connections[i] = conn 211 | } 212 | } 213 | 214 | func setPayload(p *testpb.Payload, size int) { 215 | if size < 0 { 216 | log.Fatalf("Requested an invalid length %d", size) 217 | } 218 | body := make([]byte, size) 219 | p.Body = body 220 | } 221 | 222 | // NewPayload creates a payload with the given type and size. 223 | func NewPayload(size int) *testpb.Payload { 224 | p := new(testpb.Payload) 225 | setPayload(p, size) 226 | return p 227 | } 228 | -------------------------------------------------------------------------------- /GoGrpcClient/protos/benchmark_service.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2015 gRPC authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // An integration test service that covers all the method signature permutations 16 | // of unary/streaming requests/responses. 17 | syntax = "proto3"; 18 | 19 | import "grpc/testing/messages.proto"; 20 | 21 | package grpc.testing; 22 | 23 | service BenchmarkService { 24 | // One request followed by one response. 25 | // The server returns the client payload as-is. 26 | rpc UnaryCall(SimpleRequest) returns (SimpleResponse); 27 | 28 | // Repeated sequence of one request followed by one response. 29 | // Should be called streaming ping-pong 30 | // The server returns the client payload as-is on each response 31 | rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse); 32 | 33 | // Single-sided unbounded streaming from client to server 34 | // The server returns the client payload as-is once the client does WritesDone 35 | rpc StreamingFromClient(stream SimpleRequest) returns (SimpleResponse); 36 | 37 | // Single-sided unbounded streaming from server to client 38 | // The server repeatedly returns the client payload as-is 39 | rpc StreamingFromServer(SimpleRequest) returns (stream SimpleResponse); 40 | 41 | // Two-sided unbounded streaming between server to client 42 | // Both sides send the content of their own choice to the other 43 | rpc StreamingBothWays(stream SimpleRequest) returns (stream SimpleResponse); 44 | } 45 | -------------------------------------------------------------------------------- /GoGrpcClient/protos/grpc/testing/messages.proto: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2015-2016 gRPC authors. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | // Message definitions to be used by integration test service definitions. 17 | 18 | syntax = "proto3"; 19 | 20 | package grpc.testing; 21 | 22 | // TODO(dgq): Go back to using well-known types once 23 | // https://github.com/grpc/grpc/issues/6980 has been fixed. 24 | // import "google/protobuf/wrappers.proto"; 25 | message BoolValue { 26 | // The bool value. 27 | bool value = 1; 28 | } 29 | 30 | // The type of payload that should be returned. 31 | enum PayloadType { 32 | // Compressable text format. 33 | COMPRESSABLE = 0; 34 | } 35 | 36 | // A block of data, to simply increase gRPC message size. 37 | message Payload { 38 | // The type of data in body. 39 | PayloadType type = 1; 40 | // Primary contents of payload. 41 | bytes body = 2; 42 | } 43 | 44 | // A protobuf representation for grpc status. This is used by test 45 | // clients to specify a status that the server should attempt to return. 46 | message EchoStatus { 47 | int32 code = 1; 48 | string message = 2; 49 | } 50 | 51 | // The type of route that a client took to reach a server w.r.t. gRPCLB. 52 | // The server must fill in "fallback" if it detects that the RPC reached 53 | // the server via the "gRPCLB fallback" path, and "backend" if it detects 54 | // that the RPC reached the server via "gRPCLB backend" path (i.e. if it got 55 | // the address of this server from the gRPCLB server BalanceLoad RPC). Exactly 56 | // how this detection is done is context and server dependant. 57 | enum GrpclbRouteType { 58 | // Server didn't detect the route that a client took to reach it. 59 | GRPCLB_ROUTE_TYPE_UNKNOWN = 0; 60 | // Indicates that a client reached a server via gRPCLB fallback. 61 | GRPCLB_ROUTE_TYPE_FALLBACK = 1; 62 | // Indicates that a client reached a server as a gRPCLB-given backend. 63 | GRPCLB_ROUTE_TYPE_BACKEND = 2; 64 | } 65 | 66 | // Unary request. 67 | message SimpleRequest { 68 | // Desired payload type in the response from the server. 69 | // If response_type is RANDOM, server randomly chooses one from other formats. 70 | PayloadType response_type = 1; 71 | 72 | // Desired payload size in the response from the server. 73 | int32 response_size = 2; 74 | 75 | // Optional input payload sent along with the request. 76 | Payload payload = 3; 77 | 78 | // Whether SimpleResponse should include username. 79 | bool fill_username = 4; 80 | 81 | // Whether SimpleResponse should include OAuth scope. 82 | bool fill_oauth_scope = 5; 83 | 84 | // Whether to request the server to compress the response. This field is 85 | // "nullable" in order to interoperate seamlessly with clients not able to 86 | // implement the full compression tests by introspecting the call to verify 87 | // the response's compression status. 88 | BoolValue response_compressed = 6; 89 | 90 | // Whether server should return a given status 91 | EchoStatus response_status = 7; 92 | 93 | // Whether the server should expect this request to be compressed. 94 | BoolValue expect_compressed = 8; 95 | 96 | // Whether SimpleResponse should include server_id. 97 | bool fill_server_id = 9; 98 | 99 | // Whether SimpleResponse should include grpclb_route_type. 100 | bool fill_grpclb_route_type = 10; 101 | } 102 | 103 | // Unary response, as configured by the request. 104 | message SimpleResponse { 105 | // Payload to increase message size. 106 | Payload payload = 1; 107 | // The user the request came from, for verifying authentication was 108 | // successful when the client expected it. 109 | string username = 2; 110 | // OAuth scope. 111 | string oauth_scope = 3; 112 | // Server ID. This must be unique among different server instances, 113 | // but the same across all RPC's made to a particular server instance. 114 | string server_id = 4; 115 | // gRPCLB Path. 116 | GrpclbRouteType grpclb_route_type = 5; 117 | } 118 | 119 | // Client-streaming request. 120 | message StreamingInputCallRequest { 121 | // Optional input payload sent along with the request. 122 | Payload payload = 1; 123 | 124 | // Whether the server should expect this request to be compressed. This field 125 | // is "nullable" in order to interoperate seamlessly with servers not able to 126 | // implement the full compression tests by introspecting the call to verify 127 | // the request's compression status. 128 | BoolValue expect_compressed = 2; 129 | 130 | // Not expecting any payload from the response. 131 | } 132 | 133 | // Client-streaming response. 134 | message StreamingInputCallResponse { 135 | // Aggregated size of payloads received from the client. 136 | int32 aggregated_payload_size = 1; 137 | } 138 | 139 | // Configuration for a particular response. 140 | message ResponseParameters { 141 | // Desired payload sizes in responses from the server. 142 | int32 size = 1; 143 | 144 | // Desired interval between consecutive responses in the response stream in 145 | // microseconds. 146 | int32 interval_us = 2; 147 | 148 | // Whether to request the server to compress the response. This field is 149 | // "nullable" in order to interoperate seamlessly with clients not able to 150 | // implement the full compression tests by introspecting the call to verify 151 | // the response's compression status. 152 | BoolValue compressed = 3; 153 | } 154 | 155 | // Server-streaming request. 156 | message StreamingOutputCallRequest { 157 | // Desired payload type in the response from the server. 158 | // If response_type is RANDOM, the payload from each response in the stream 159 | // might be of different types. This is to simulate a mixed type of payload 160 | // stream. 161 | PayloadType response_type = 1; 162 | 163 | // Configuration for each expected response message. 164 | repeated ResponseParameters response_parameters = 2; 165 | 166 | // Optional input payload sent along with the request. 167 | Payload payload = 3; 168 | 169 | // Whether server should return a given status 170 | EchoStatus response_status = 7; 171 | } 172 | 173 | // Server-streaming response, as configured by the request and parameters. 174 | message StreamingOutputCallResponse { 175 | // Payload to increase response size. 176 | Payload payload = 1; 177 | } 178 | 179 | // For reconnect interop test only. 180 | // Client tells server what reconnection parameters it used. 181 | message ReconnectParams { 182 | int32 max_reconnect_backoff_ms = 1; 183 | } 184 | 185 | // For reconnect interop test only. 186 | // Server tells client whether its reconnects are following the spec and the 187 | // reconnect backoffs it saw. 188 | message ReconnectInfo { 189 | bool passed = 1; 190 | repeated int32 backoff_ms = 2; 191 | } 192 | -------------------------------------------------------------------------------- /GrpcCoreServer/GrpcCoreServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /GrpcCoreServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Grpc.Core; 4 | using GrpcSampleServer; 5 | 6 | namespace GrpcCoreServer 7 | { 8 | class Program 9 | { 10 | static async Task Main(string[] args) 11 | { 12 | var server = new Server 13 | { 14 | Services = { GrpcSample.Greeter.BindService(new GreeterService()) } 15 | }; 16 | 17 | var host = "0.0.0.0"; 18 | var port = 5001; 19 | server.Ports.Add(host, port, ServerCredentials.Insecure); 20 | Console.WriteLine("Running server on " + string.Format("{0}:{1}", host, port)); 21 | server.Start(); 22 | 23 | await server.ShutdownTask; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GrpcSampleClient/GrpcSampleClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp5.0 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /GrpcSampleClient/Program.cs: -------------------------------------------------------------------------------- 1 | using Google.Protobuf; 2 | using Grpc.Core; 3 | using Grpc.Net.Client; 4 | using GrpcSample; 5 | using Microsoft.AspNetCore.SignalR.Client; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using Microsoft.IO; 8 | using System; 9 | using System.Buffers.Binary; 10 | using System.Collections.Concurrent; 11 | using System.Collections.Generic; 12 | using System.Diagnostics; 13 | using System.IO; 14 | using System.Linq; 15 | using System.Net; 16 | using System.Net.Http; 17 | using System.Net.Http.Json; 18 | using System.Runtime; 19 | using System.Text.Json; 20 | using System.Threading; 21 | using System.Threading.Channels; 22 | using System.Threading.Tasks; 23 | using Channel = Grpc.Core.Channel; 24 | 25 | namespace GrpcSampleClient 26 | { 27 | public class Program 28 | { 29 | private static readonly RecyclableMemoryStreamManager StreamPool = new RecyclableMemoryStreamManager(); 30 | private static readonly Dictionary GrpcClientCache = new Dictionary(); 31 | private static readonly Dictionary> GrpcStreamCache = new Dictionary>(); 32 | private static readonly Dictionary HttpClientCache = new Dictionary(); 33 | private static readonly Dictionary HttpMessageInvokerCache = new Dictionary(); 34 | private static readonly ConcurrentDictionary SignalRCache = new ConcurrentDictionary(); 35 | private static Uri RawGrpcUri= new Uri($"http://localhost:5001/greet.Greeter/SayHello"); 36 | private static bool ClientPerThread; 37 | 38 | static async Task Main(string[] args) 39 | { 40 | ClientPerThread = bool.Parse(args[2]); 41 | Console.WriteLine("ClientPerThread: " + ClientPerThread); 42 | var stopwatch = Stopwatch.StartNew(); 43 | long successCounter = 0; 44 | long errorCounter = 0; 45 | long lastElapse = 0; 46 | Exception lastError = null; 47 | 48 | new Thread(() => 49 | { 50 | long pastRequests = 0; 51 | while (true) 52 | { 53 | var e = lastElapse; 54 | var ex = lastError; 55 | Console.WriteLine($"Successfully processed {successCounter}; RPS {successCounter - pastRequests}; Errors {errorCounter}; Last elapsed {TimeSpan.FromTicks(lastElapse).TotalMilliseconds}ms"); 56 | if (ex != null) 57 | { 58 | Console.WriteLine(ex.ToString()); 59 | } 60 | pastRequests = successCounter; 61 | Thread.Sleep(1000); 62 | } 63 | }) 64 | { IsBackground = true }.Start(); 65 | 66 | Func request; 67 | string clientType; 68 | switch (args[0]) 69 | { 70 | case "g": 71 | request = (i) => MakeGrpcCall(new HelloRequest() { Name = "foo" }, GetGrpcNetClient(i)); 72 | clientType = "Grpc.Net.Client"; 73 | break; 74 | case "gs": 75 | request = (i) => MakeGrpcCallBiDi(new HelloRequest() { Name = "foo" }, GetGrpcNetClientStream(i)); 76 | clientType = "Grpc.Net.Client BiDi"; 77 | break; 78 | case "c": 79 | request = (i) => MakeGrpcCall(new HelloRequest() { Name = "foo" }, GetGrpcCoreClient(i)); 80 | clientType = "Grpc.Core"; 81 | break; 82 | case "r": 83 | request = (i) => MakeRawGrpcCall(new HelloRequest() { Name = "foo" }, GetHttpMessageInvoker(i), streamRequest: false, streamResponse: false); 84 | clientType = "Raw HttpMessageInvoker"; 85 | break; 86 | case "r-stream-request": 87 | request = (i) => MakeRawGrpcCall(new HelloRequest() { Name = "foo" }, GetHttpMessageInvoker(i), streamRequest: true, streamResponse: false); 88 | clientType = "Raw HttpMessageInvoker"; 89 | break; 90 | case "r-stream-response": 91 | request = (i) => MakeRawGrpcCall(new HelloRequest() { Name = "foo" }, GetHttpMessageInvoker(i), streamRequest: false, streamResponse: true); 92 | clientType = "Raw HttpMessageInvoker"; 93 | break; 94 | case "r-stream-all": 95 | request = (i) => MakeRawGrpcCall(new HelloRequest() { Name = "foo" }, GetHttpMessageInvoker(i), streamRequest: true, streamResponse: true); 96 | clientType = "Raw HttpMessageInvoker"; 97 | break; 98 | case "h2": 99 | request = (i) => MakeProtobufHttpCall(new HelloRequest() { Name = "foo" }, GetHttpClient(i, 5001), HttpVersion.Version20); 100 | clientType = "HttpClient+HTTP/2"; 101 | break; 102 | case "h1": 103 | request = (i) => MakeProtobufHttpCall(new HelloRequest() { Name = "foo" }, GetHttpClient(i, 5000), HttpVersion.Version11); 104 | clientType = "HttpClient+HTTP/1.1"; 105 | break; 106 | case "h2-json": 107 | request = (i) => MakeJsonHttpCall(new HelloRequest() { Name = "foo" }, GetHttpClient(i, 5001), HttpVersion.Version20); 108 | clientType = "HttpClient+JSON+HTTP/2"; 109 | break; 110 | case "h1-json": 111 | request = (i) => MakeJsonHttpCall(new HelloRequest() { Name = "foo" }, GetHttpClient(i, 5000), HttpVersion.Version11); 112 | clientType = "HttpClient+JSON+HTTP/1.1"; 113 | break; 114 | case "s": 115 | request = async (i) => await MakeSignalRCall(new HelloRequest() { Name = "foo" }, await GetSignalRStateAsync(i)); 116 | clientType = "SignalR BiDi"; 117 | break; 118 | default: 119 | throw new ArgumentException("Argument missing"); 120 | } 121 | Console.WriteLine("Client type: " + clientType); 122 | 123 | var parallelism = int.Parse(args[1]); 124 | Console.WriteLine("Parallelism: " + parallelism); 125 | Console.WriteLine($"{nameof(GCSettings.IsServerGC)}: {GCSettings.IsServerGC}"); 126 | 127 | await Task.WhenAll(Enumerable.Range(0, parallelism).Select(async i => 128 | { 129 | Stopwatch s = Stopwatch.StartNew(); 130 | while (true) 131 | { 132 | var start = s.ElapsedTicks; 133 | try 134 | { 135 | await request(i); 136 | } 137 | catch (Exception ex) 138 | { 139 | lastError = ex; 140 | Interlocked.Increment(ref errorCounter); 141 | } 142 | lastElapse = s.ElapsedTicks - start; 143 | 144 | Interlocked.Increment(ref successCounter); 145 | } 146 | })); 147 | } 148 | 149 | private static Greeter.GreeterClient GetGrpcNetClient(int i) 150 | { 151 | if (!ClientPerThread) 152 | { 153 | i = 0; 154 | } 155 | if (!GrpcClientCache.TryGetValue(i, out var client)) 156 | { 157 | client = GetGrpcNetClient("localhost", 5001); 158 | GrpcClientCache.Add(i, client); 159 | } 160 | 161 | return client; 162 | } 163 | 164 | private static Greeter.GreeterClient GetGrpcCoreClient(int i) 165 | { 166 | if (!ClientPerThread) 167 | { 168 | i = 0; 169 | } 170 | if (!GrpcClientCache.TryGetValue(i, out var client)) 171 | { 172 | client = GetGrpcCoreClient("localhost", 5001); 173 | GrpcClientCache.Add(i, client); 174 | } 175 | 176 | return client; 177 | } 178 | 179 | private static async Task GetSignalRStateAsync(int i) 180 | { 181 | if (!SignalRCache.TryGetValue(i, out var state)) 182 | { 183 | var builder = new HubConnectionBuilder(); 184 | builder.WithUrl("http://localhost:5000/greeterhub"); 185 | builder.AddMessagePackProtocol(); 186 | var hubConnection = builder.Build(); 187 | await hubConnection.StartAsync(); 188 | 189 | var channel = System.Threading.Channels.Channel.CreateUnbounded(new UnboundedChannelOptions 190 | { 191 | SingleReader = true, 192 | SingleWriter = true 193 | }); 194 | 195 | var result = hubConnection.StreamAsync("SayHelloBiDi", channel.Reader); 196 | state = new SignalRStreamingCall 197 | { 198 | RequestStream = channel.Writer, 199 | ResponseStream = result.GetAsyncEnumerator() 200 | }; 201 | 202 | bool success = SignalRCache.TryAdd(i, state); 203 | if (!success) 204 | { 205 | throw new InvalidOperationException(); 206 | } 207 | } 208 | 209 | return state; 210 | } 211 | 212 | private static AsyncDuplexStreamingCall GetGrpcNetClientStream(int i) 213 | { 214 | if (!GrpcStreamCache.TryGetValue(i, out var stream)) 215 | { 216 | var client = GetGrpcNetClient(i); 217 | stream = client.SayHelloBiDi(); 218 | GrpcStreamCache.Add(i, stream); 219 | } 220 | 221 | return stream; 222 | } 223 | 224 | private static HttpClient GetHttpClient(int i, int port) 225 | { 226 | if (!ClientPerThread) 227 | { 228 | i = 0; 229 | } 230 | if (!HttpClientCache.TryGetValue(i, out var client)) 231 | { 232 | client = new HttpClient { BaseAddress = new Uri("http://localhost:" + port) }; 233 | HttpClientCache.Add(i, client); 234 | } 235 | 236 | return client; 237 | } 238 | 239 | private static HttpMessageInvoker GetHttpMessageInvoker(int i) 240 | { 241 | if (!ClientPerThread) 242 | { 243 | i = 0; 244 | } 245 | if (!HttpMessageInvokerCache.TryGetValue(i, out var client)) 246 | { 247 | client = new HttpMessageInvoker(new SocketsHttpHandler { AllowAutoRedirect = false, UseProxy = false }); 248 | HttpMessageInvokerCache.Add(i, client); 249 | } 250 | 251 | return client; 252 | } 253 | 254 | private static Greeter.GreeterClient GetGrpcNetClient(string host, int port) 255 | { 256 | var httpHandler = new HttpClientHandler() { UseProxy = false, AllowAutoRedirect = false }; 257 | var baseUri = new UriBuilder 258 | { 259 | Scheme = Uri.UriSchemeHttp, 260 | Host = host, 261 | Port = port 262 | 263 | }; 264 | var channelOptions = new GrpcChannelOptions 265 | { 266 | HttpHandler = httpHandler 267 | }; 268 | return new Greeter.GreeterClient(GrpcChannel.ForAddress(baseUri.Uri, channelOptions)); 269 | } 270 | 271 | private static Greeter.GreeterClient GetGrpcCoreClient(string host, int port) 272 | { 273 | var channel = new Channel(host + ":" + port, ChannelCredentials.Insecure); 274 | return new Greeter.GreeterClient(channel); 275 | } 276 | 277 | private static async Task MakeGrpcCall(HelloRequest request, Greeter.GreeterClient client) 278 | { 279 | return await client.SayHelloAsync(request); 280 | } 281 | 282 | private static async Task MakeGrpcCallBiDi(HelloRequest request, AsyncDuplexStreamingCall client) 283 | { 284 | await client.RequestStream.WriteAsync(request); 285 | await client.ResponseStream.MoveNext(); 286 | return client.ResponseStream.Current; 287 | } 288 | 289 | private static async Task MakeSignalRCall(HelloRequest request, SignalRStreamingCall state) 290 | { 291 | await state.RequestStream.WriteAsync(request.Name); 292 | if (!await state.ResponseStream.MoveNextAsync()) 293 | { 294 | throw new InvalidOperationException("Unexpected end of stream."); 295 | } 296 | return new HelloReply 297 | { 298 | Message = state.ResponseStream.Current 299 | }; 300 | } 301 | 302 | private static async Task MakeProtobufHttpCall(HelloRequest request, HttpClient client, Version httpVersion) 303 | { 304 | using var memStream = StreamPool.GetStream(); 305 | request.WriteDelimitedTo(memStream); 306 | memStream.Position = 0; 307 | using var httpRequest = new HttpRequestMessage() 308 | { 309 | Method = HttpMethod.Post, 310 | Content = new StreamContent(memStream), 311 | Version = httpVersion, 312 | VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher, 313 | RequestUri = new Uri("/protobuf", UriKind.Relative) 314 | }; 315 | httpRequest.Content.Headers.TryAddWithoutValidation("Content-Type", "application/octet-stream"); 316 | using var httpResponse = await client.SendAsync(httpRequest); 317 | var responseStream = await httpResponse.Content.ReadAsStreamAsync(); 318 | return HelloReply.Parser.ParseDelimitedFrom(responseStream); 319 | } 320 | 321 | private static async Task MakeJsonHttpCall(HelloRequest request, HttpClient client, Version httpVersion) 322 | { 323 | using var httpRequest = new HttpRequestMessage() 324 | { 325 | Method = HttpMethod.Post, 326 | Content = new StringContent(JsonSerializer.Serialize(request)), 327 | Version = httpVersion, 328 | VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher, 329 | RequestUri = new Uri("/api/greeter/sayhello", UriKind.Relative) 330 | }; 331 | httpRequest.Content.Headers.TryAddWithoutValidation("Content-Type", "application/json"); 332 | using var httpResponse = await client.SendAsync(httpRequest); 333 | //Debugger.Launch(); 334 | return await httpResponse.Content.ReadFromJsonAsync(); 335 | } 336 | 337 | private const int HeaderSize = 5; 338 | private static readonly CancellationTokenSource Cts = new CancellationTokenSource(); 339 | 340 | private static async Task MakeRawGrpcCall(HelloRequest request, HttpMessageInvoker client, bool streamRequest, bool streamResponse) 341 | { 342 | using var httpRequest = new HttpRequestMessage(HttpMethod.Post, RawGrpcUri); 343 | httpRequest.Version = HttpVersion.Version20; 344 | httpRequest.VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher; 345 | 346 | if (!streamRequest) 347 | { 348 | var messageSize = request.CalculateSize(); 349 | var data = new byte[messageSize + HeaderSize]; 350 | request.WriteTo(new CodedOutputStream(data)); 351 | 352 | Array.Copy(data, 0, data, HeaderSize, messageSize); 353 | data[0] = 0; 354 | BinaryPrimitives.WriteUInt32BigEndian(data.AsSpan(1, 4), (uint)messageSize); 355 | 356 | httpRequest.Content = new ByteArrayContent(data); 357 | httpRequest.Content.Headers.TryAddWithoutValidation("Content-Type", "application/grpc"); 358 | } 359 | else 360 | { 361 | httpRequest.Content = new PushUnaryContent(request); 362 | } 363 | 364 | httpRequest.Headers.TryAddWithoutValidation("TE", "trailers"); 365 | 366 | using var response = await client.SendAsync(httpRequest, Cts.Token); 367 | response.EnsureSuccessStatusCode(); 368 | 369 | HelloReply responseMessage; 370 | if (!streamResponse) 371 | { 372 | var data = await response.Content.ReadAsByteArrayAsync(); 373 | responseMessage = HelloReply.Parser.ParseFrom(data.AsSpan(5).ToArray()); 374 | } 375 | else 376 | { 377 | var responseStream = await response.Content.ReadAsStreamAsync(); 378 | var data = new byte[HeaderSize]; 379 | 380 | int read; 381 | var received = 0; 382 | while ((read = await responseStream.ReadAsync(data.AsMemory(received, HeaderSize - received), Cts.Token).ConfigureAwait(false)) > 0) 383 | { 384 | received += read; 385 | 386 | if (received == HeaderSize) 387 | { 388 | break; 389 | } 390 | } 391 | 392 | if (received < HeaderSize) 393 | { 394 | throw new InvalidDataException("Unexpected end of content while reading the message header."); 395 | } 396 | 397 | var length = (int)BinaryPrimitives.ReadUInt32BigEndian(data.AsSpan(1, 4)); 398 | 399 | if (data.Length < length) 400 | { 401 | data = new byte[length]; 402 | } 403 | 404 | received = 0; 405 | while ((read = await responseStream.ReadAsync(data.AsMemory(received, length - received), Cts.Token).ConfigureAwait(false)) > 0) 406 | { 407 | received += read; 408 | 409 | if (received == length) 410 | { 411 | break; 412 | } 413 | } 414 | 415 | read = await responseStream.ReadAsync(data, Cts.Token); 416 | if (read > 0) 417 | { 418 | throw new InvalidDataException("Extra data returned."); 419 | } 420 | 421 | responseMessage = HelloReply.Parser.ParseFrom(data); 422 | } 423 | 424 | var grpcStatus = response.TrailingHeaders.GetValues("grpc-status").SingleOrDefault(); 425 | if (grpcStatus != "0") 426 | { 427 | throw new InvalidOperationException($"Unexpected grpc-status: {grpcStatus}"); 428 | } 429 | 430 | return responseMessage; 431 | } 432 | 433 | private class SignalRStreamingCall 434 | { 435 | public ChannelWriter RequestStream { get; set; } 436 | public IAsyncEnumerator ResponseStream { get; set; } 437 | } 438 | } 439 | } 440 | -------------------------------------------------------------------------------- /GrpcSampleClient/PushUnaryContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers.Binary; 3 | using System.IO; 4 | using System.Net; 5 | using System.Net.Http; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using Google.Protobuf; 9 | 10 | namespace GrpcSampleClient 11 | { 12 | internal class PushUnaryContent : HttpContent where TRequest : IMessage 13 | { 14 | private readonly TRequest _content; 15 | 16 | public PushUnaryContent(TRequest content) 17 | { 18 | _content = content; 19 | Headers.TryAddWithoutValidation("Content-Type", "application/grpc"); 20 | } 21 | 22 | protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context) 23 | { 24 | const int headerSize = 5; 25 | 26 | var messageSize = _content.CalculateSize(); 27 | 28 | var data = new byte[headerSize]; 29 | data[0] = 0; 30 | BinaryPrimitives.WriteUInt32BigEndian(data.AsSpan(1, 4), (uint)messageSize); 31 | await stream.WriteAsync(data, CancellationToken.None).ConfigureAwait(false); 32 | 33 | data = new byte[messageSize]; 34 | _content.WriteTo(new CodedOutputStream(data)); 35 | await stream.WriteAsync(data, CancellationToken.None).ConfigureAwait(false); 36 | } 37 | 38 | protected override bool TryComputeLength(out long length) 39 | { 40 | // We can't know the length of the content being pushed to the output stream. 41 | length = -1; 42 | return false; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GrpcSampleServer/Controller/GreeterController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Http; 6 | using Microsoft.AspNetCore.Mvc; 7 | 8 | namespace GrpcSampleServer.Controller 9 | { 10 | [Route("api/[controller]")] 11 | [ApiController] 12 | public class GreeterController : ControllerBase 13 | { 14 | [HttpPost("SayHello")] 15 | public Task SayHello(HelloRequest request) 16 | { 17 | return Task.FromResult(new HelloReply 18 | { 19 | Message = "Hello " + request.Name 20 | }); 21 | } 22 | } 23 | 24 | public class HelloRequest 25 | { 26 | public string Name { get; set; } 27 | } 28 | 29 | public class HelloReply 30 | { 31 | public string Message { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /GrpcSampleServer/GrpcSampleServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /GrpcSampleServer/Hubs/GreeterHub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.CompilerServices; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Microsoft.AspNetCore.SignalR; 8 | 9 | namespace GrpcSampleServer.Hubs 10 | { 11 | public class GreeterHub : Hub 12 | { 13 | public async IAsyncEnumerable SayHelloBiDi( 14 | IAsyncEnumerable names, 15 | [EnumeratorCancellation] 16 | CancellationToken cancellationToken) 17 | { 18 | await foreach (var name in names) 19 | { 20 | cancellationToken.ThrowIfCancellationRequested(); 21 | 22 | yield return "Hello " + name; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GrpcSampleServer/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.AspNetCore.Server.Kestrel.Core; 3 | using Microsoft.Extensions.Hosting; 4 | using Microsoft.Extensions.Logging; 5 | 6 | namespace GrpcSampleServer 7 | { 8 | public class Program 9 | { 10 | public static void Main(string[] args) 11 | { 12 | CreateHostBuilder(args).Build().Run(); 13 | } 14 | 15 | public static IHostBuilder CreateHostBuilder(string[] args) => 16 | Host.CreateDefaultBuilder(args) 17 | .ConfigureLogging(builder => 18 | { 19 | //builder.SetMinimumLevel(LogLevel.Error); 20 | //builder.ClearProviders(); 21 | }) 22 | .ConfigureWebHostDefaults(webBuilder => 23 | { 24 | webBuilder.ConfigureKestrel(o => 25 | { 26 | o.ListenLocalhost(5000, endpoint => endpoint.Protocols = HttpProtocols.Http1); 27 | o.ListenLocalhost(5001, endpoint => endpoint.Protocols = HttpProtocols.Http2); 28 | o.ListenLocalhost(5002, endpoint => 29 | { 30 | endpoint.Protocols = HttpProtocols.Http1AndHttp2; 31 | endpoint.UseHttps(); 32 | }); 33 | }); 34 | webBuilder.UseStartup(); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /GrpcSampleServer/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "GrpcSampleServer": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "applicationUrl": "https://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /GrpcSampleServer/Protos/greet.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option csharp_namespace = "GrpcSample"; 4 | 5 | package greet; 6 | 7 | // The greeting service definition. 8 | service Greeter { 9 | // Sends a greeting 10 | rpc SayHello (HelloRequest) returns (HelloReply); 11 | rpc SayHelloBiDi (stream HelloRequest) returns (stream HelloReply); 12 | } 13 | 14 | // The request message containing the user's name. 15 | message HelloRequest { 16 | string name = 1; 17 | } 18 | 19 | // The response message containing the greetings. 20 | message HelloReply { 21 | string message = 1; 22 | } 23 | -------------------------------------------------------------------------------- /GrpcSampleServer/Services/GreeterService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Grpc.Core; 3 | using GrpcSample; 4 | 5 | namespace GrpcSampleServer 6 | { 7 | public class GreeterService : Greeter.GreeterBase 8 | { 9 | public override Task SayHello(HelloRequest request, ServerCallContext context) 10 | { 11 | return Task.FromResult(new HelloReply 12 | { 13 | Message = "Hello " + request.Name 14 | }); 15 | } 16 | 17 | public override async Task SayHelloBiDi(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) 18 | { 19 | while (await requestStream.MoveNext()) 20 | { 21 | var helloReply = new HelloReply 22 | { 23 | Message = "Hello " + requestStream.Current.Name 24 | }; 25 | 26 | await responseStream.WriteAsync(helloReply); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GrpcSampleServer/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Threading.Tasks; 7 | using Google.Protobuf; 8 | using GrpcSample; 9 | using GrpcSampleServer.Hubs; 10 | using Microsoft.AspNetCore.Builder; 11 | using Microsoft.AspNetCore.Hosting; 12 | using Microsoft.AspNetCore.Http; 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.Hosting; 15 | using Microsoft.IO; 16 | 17 | namespace GrpcSampleServer 18 | { 19 | public class Startup 20 | { 21 | private static readonly RecyclableMemoryStreamManager StreamPool = new RecyclableMemoryStreamManager(); 22 | 23 | public void ConfigureServices(IServiceCollection services) 24 | { 25 | services.AddSignalR().AddMessagePackProtocol(); 26 | services.AddGrpc(o => o.IgnoreUnknownServices = true); 27 | services.AddControllers(); 28 | } 29 | 30 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 31 | { 32 | if (env.IsDevelopment()) 33 | { 34 | app.UseDeveloperExceptionPage(); 35 | } 36 | 37 | app.UseRouting(); 38 | 39 | app.UseEndpoints(endpoints => 40 | { 41 | endpoints.MapGrpcService(); 42 | 43 | endpoints.MapControllers(); 44 | 45 | endpoints.MapHub("/greeterhub"); 46 | 47 | endpoints.MapPost("/protobuf", async context => 48 | { 49 | using var memStream = StreamPool.GetStream(); 50 | await context.Request.Body.CopyToAsync(memStream); 51 | memStream.Position = 0; 52 | var request = HelloRequest.Parser.ParseDelimitedFrom(memStream); 53 | var response = new HelloReply 54 | { 55 | Message = "Hello " + request.Name 56 | }; 57 | memStream.Position = 0; 58 | memStream.SetLength(0); 59 | response.WriteDelimitedTo(memStream); 60 | memStream.Position = 0; 61 | context.Response.StatusCode = (int)HttpStatusCode.Accepted; 62 | await memStream.CopyToAsync(context.Response.Body); 63 | }); 64 | }); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /GrpcSampleServer/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "System": "Information", 6 | "Grpc": "Information", 7 | "Microsoft": "Warning" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /GrpcSampleServer/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Http2Perf.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30011.22 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GrpcSampleClient", "GrpcSampleClient\GrpcSampleClient.csproj", "{18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GrpcSampleServer", "GrpcSampleServer\GrpcSampleServer.csproj", "{AD0A0A13-0D9B-4862-912F-49154E6C557F}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrpcCoreServer", "GrpcCoreServer\GrpcCoreServer.csproj", "{C106C760-CAB0-4433-8B88-C82C2A30BB23}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|x64 = Debug|x64 16 | Debug|x86 = Debug|x86 17 | Release|Any CPU = Release|Any CPU 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Debug|x64.ActiveCfg = Debug|Any CPU 25 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Debug|x64.Build.0 = Debug|Any CPU 26 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Debug|x86.ActiveCfg = Debug|Any CPU 27 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Debug|x86.Build.0 = Debug|Any CPU 28 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Release|x64.ActiveCfg = Release|Any CPU 31 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Release|x64.Build.0 = Release|Any CPU 32 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Release|x86.ActiveCfg = Release|Any CPU 33 | {18A0E798-FB6C-4A7D-89FA-C6762E06F4CA}.Release|x86.Build.0 = Release|Any CPU 34 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Debug|x64.ActiveCfg = Debug|Any CPU 37 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Debug|x64.Build.0 = Debug|Any CPU 38 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Debug|x86.ActiveCfg = Debug|Any CPU 39 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Debug|x86.Build.0 = Debug|Any CPU 40 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Release|x64.ActiveCfg = Release|Any CPU 43 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Release|x64.Build.0 = Release|Any CPU 44 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Release|x86.ActiveCfg = Release|Any CPU 45 | {AD0A0A13-0D9B-4862-912F-49154E6C557F}.Release|x86.Build.0 = Release|Any CPU 46 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Debug|x64.ActiveCfg = Debug|Any CPU 49 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Debug|x64.Build.0 = Debug|Any CPU 50 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Debug|x86.ActiveCfg = Debug|Any CPU 51 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Debug|x86.Build.0 = Debug|Any CPU 52 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Release|x64.ActiveCfg = Release|Any CPU 55 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Release|x64.Build.0 = Release|Any CPU 56 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Release|x86.ActiveCfg = Release|Any CPU 57 | {C106C760-CAB0-4433-8B88-C82C2A30BB23}.Release|x86.Build.0 = Release|Any CPU 58 | EndGlobalSection 59 | GlobalSection(SolutionProperties) = preSolution 60 | HideSolutionNode = FALSE 61 | EndGlobalSection 62 | GlobalSection(ExtensibilityGlobals) = postSolution 63 | SolutionGuid = {2AD9CEAC-FCC5-4C9D-9F73-332FA440FA92} 64 | EndGlobalSection 65 | EndGlobal 66 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HTTP/2 Perf on .NET 2 | 3 | Run the server: 4 | 5 | ``` 6 | dotnet run -c Release -p GrpcSampleServer 7 | ``` 8 | 9 | Run the client: 10 | 11 | ``` 12 | dotnet run -c Release -p GrpcSampleClient client concurrency connectionPerThread 13 | ``` 14 | 15 | Clients: 16 | * r = gRPC with raw HttpClient 17 | * r-stream-request = gRPC with raw HttpClient (stream request) 18 | * r-stream-response = gRPC with raw HttpClient (stream response) 19 | * r-stream-all = gRPC with raw HttpClient (stream all) 20 | * g = gRPC with Grpc.Net.Client 21 | * gs = gRPC bidi streaming with Grpc.Net.Client 22 | * c = gRPC with Grpc.Core 23 | * h1 = Protobuf with HttpClient+HTTP/1 24 | * h2 = Protobuf with HttpClient+HTTP/2 25 | * h1-json = JSON with HttpClient+HTTP/1 26 | * h2-json = JSON with HttpClient+HTTP/2 27 | * s = SignalR bidi streaming (messagepack) 28 | 29 | Example - Grpc.Net.Client + 100 callers + connection per thread (100 connections) 30 | 31 | ``` 32 | dotnet run -c Release -p GrpcSampleClient g 100 true 33 | ``` --------------------------------------------------------------------------------