Re: [go-nuts] Performance for concurrent requests

2022-12-02 Thread Andrew Harris
I wonder a bit about io.ReadAll versus constructing a JSON Decoder. In 
general, though, using pprof is the best way to start to break down a 
question like this. Would the actual workload involve more structured JSON, 
or more computation with decoded values?

On Friday, December 2, 2022 at 7:31:50 PM UTC-8 bse...@computer.org wrote:

> On Fri, Dec 2, 2022 at 8:13 PM Diogo Baeder  wrote:
>
>> Hi guys,
>>
>> I've been working on some experiments with different web application 
>> stacks to check their performances under a specific scenario: one in which 
>> I have to make several concurrent requests and then gather the results 
>> together (in order) and throw them out as JSON in the response body. (This 
>> project is only an experiment, but it's informing me for decisions that 
>> have to be made for a real-world project where we have a similar scenario.)
>>
>> However, probably due to my ignorance in Go, I cannot make it perform as 
>> well as I expected - actually the best I'm getting are results that are 
>> even slower than Python, which was a surprise to me. Here they are: 
>> https://github.com/yougov/concurrency-tests#edit-13-added-golang-with-gin 
>>
>> So, looking at the code here: 
>> https://github.com/yougov/concurrency-tests/blob/master/stacks/goapp/main.go 
>> - does anybody see any problem in the implementation that could be hurting 
>> performance? I tried using a WaitGroup, tried sharing memory (nasty, I 
>> know, but just for the sake of experimentation), tried multiple JSON 
>> codecs, different web frameworks, and nothing worked so far. I have a 
>> feeling that I'm doing something fundamentally wrong and stupid, and that 
>> somehow I can make a small change to make the experiment much faster.
>>
>
> Have you measured how much time is spent on the http.Get calls? It is 
> likely that the 50 concurrent http.Get calls is the bottleneck. 
>
> Also note that you don't need a channel there. You can simply use a 
> waitgroup and set the results from inside the goroutine, because each 
> goroutine knows the index. But that is unlikely to change anything 
> measurable when compared to the Get calls.
>
>  
>
>>
>> Thanks in advance, I'm sure this will help me learning more about the 
>> language! :-)
>>
>> Cheers!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/42d7d04f-f6d8-4d96-bcdf-bcf32b99a73cn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/43513c74-d0e4-4403-b2be-825ee4293e5en%40googlegroups.com.


Re: [go-nuts] Performance for concurrent requests

2022-12-02 Thread burak serdar
On Fri, Dec 2, 2022 at 8:13 PM Diogo Baeder  wrote:

> Hi guys,
>
> I've been working on some experiments with different web application
> stacks to check their performances under a specific scenario: one in which
> I have to make several concurrent requests and then gather the results
> together (in order) and throw them out as JSON in the response body. (This
> project is only an experiment, but it's informing me for decisions that
> have to be made for a real-world project where we have a similar scenario.)
>
> However, probably due to my ignorance in Go, I cannot make it perform as
> well as I expected - actually the best I'm getting are results that are
> even slower than Python, which was a surprise to me. Here they are:
> https://github.com/yougov/concurrency-tests#edit-13-added-golang-with-gin
>
> So, looking at the code here:
> https://github.com/yougov/concurrency-tests/blob/master/stacks/goapp/main.go
> - does anybody see any problem in the implementation that could be hurting
> performance? I tried using a WaitGroup, tried sharing memory (nasty, I
> know, but just for the sake of experimentation), tried multiple JSON
> codecs, different web frameworks, and nothing worked so far. I have a
> feeling that I'm doing something fundamentally wrong and stupid, and that
> somehow I can make a small change to make the experiment much faster.
>

Have you measured how much time is spent on the http.Get calls? It is
likely that the 50 concurrent http.Get calls is the bottleneck.

Also note that you don't need a channel there. You can simply use a
waitgroup and set the results from inside the goroutine, because each
goroutine knows the index. But that is unlikely to change anything
measurable when compared to the Get calls.



>
> Thanks in advance, I'm sure this will help me learning more about the
> language! :-)
>
> Cheers!
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/42d7d04f-f6d8-4d96-bcdf-bcf32b99a73cn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMV2Rqp5RVqdBj_6oQgEuZo76eS-n4VQNk%2BBE4ed8%3D7Y2zavCQ%40mail.gmail.com.


[go-nuts] Performance for concurrent requests

2022-12-02 Thread Diogo Baeder
Hi guys,

I've been working on some experiments with different web application stacks 
to check their performances under a specific scenario: one in which I have 
to make several concurrent requests and then gather the results together 
(in order) and throw them out as JSON in the response body. (This project 
is only an experiment, but it's informing me for decisions that have to be 
made for a real-world project where we have a similar scenario.)

However, probably due to my ignorance in Go, I cannot make it perform as 
well as I expected - actually the best I'm getting are results that are 
even slower than Python, which was a surprise to me. Here they are: 
https://github.com/yougov/concurrency-tests#edit-13-added-golang-with-gin 

So, looking at the code here: 
https://github.com/yougov/concurrency-tests/blob/master/stacks/goapp/main.go 
- does anybody see any problem in the implementation that could be hurting 
performance? I tried using a WaitGroup, tried sharing memory (nasty, I 
know, but just for the sake of experimentation), tried multiple JSON 
codecs, different web frameworks, and nothing worked so far. I have a 
feeling that I'm doing something fundamentally wrong and stupid, and that 
somehow I can make a small change to make the experiment much faster.

Thanks in advance, I'm sure this will help me learning more about the 
language! :-)

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/42d7d04f-f6d8-4d96-bcdf-bcf32b99a73cn%40googlegroups.com.


Re: [go-nuts] gRPC for web applications with millions of users

2022-12-02 Thread 'Christian Stewart' via golang-nuts
Hi all,

I've built a streaming RPC library compatible with grpc Protobuf service
definitions that can do bidirectional streaming to the web browser over any
AsyncIterable channel, currently using WebSockets but can also use Message
channel to webassembly and other messaging approaches.

https://github.com/aperturerobotics/starpc

As far as I know, it's the only library capable of doing browser -> server
streaming currently, as neither twirp nor grpc-web support this.

Best regards,
Christian Stewart

On Fri, Dec 2, 2022, 12:29 PM robert engels  wrote:

> There are also things like https://github.com/grpc/grpc-web
>
> On Dec 2, 2022, at 11:20 AM, 'Sean Liao' via golang-nuts <
> golang-nuts@googlegroups.com> wrote:
>
> See also https://buf.build/blog/connect-web-protobuf-grpc-in-the-browser
>
> - sean
>
>
> On Fri, Dec 2, 2022 at 4:46 PM Brian Candler  wrote:
>
>> Just checking that you came across this already?
>> https://grpc.io/blog/state-of-grpc-web/
>>
>> gRPC can't be implemented natively in browsers. You can sending something
>> gRPC-like and then convert it back to gRPC at the server.  But for
>> bi-directional streaming, I think you need to look at Websockets or
>> Server-Sent Events.
>>
>> On Friday, 2 December 2022 at 14:06:34 UTC Sankar wrote:
>>
>>> Hi,
>>>
>>> I have used gRPC for some simple applications, where the server is in
>>> Golang and the client is also another golang application. I have primarily
>>> worked in the backend and have done a lot of gRPC communication among the
>>> backend services using the likes of gRPC streams and golang.
>>>
>>> Now for the first time, I am trying to implement a web application. The
>>> client apps will be done in react-native. So I was thinking of using the
>>> javascript gen code for the client libraries.
>>>
>>> However I read from some blogposts, when I searched for how to use gRPC
>>> in javascript, I read that gRPC cannot be used for consumer facing
>>> applications and is only fit for backend applications. I read that grpc
>>> streaming will not work with Browser based applications.
>>>
>>> Also I read that gRPC will not scale if there are millions of user
>>> requests coming from browsers. I am sure that gRPC can handle a lot of
>>> backend volume, but I have not used with a lot of parallel connections.
>>>
>>> So I wanted to ask, if gRPC is used by any consumer facing applications,
>>> where the backend  is done in Go and the front end is done in some form of
>>> javascript framework, with a few million users.
>>>
>>> Any feedback, suggestions, links, etc. on this topic are also welcome.
>>>
>>> Thanks.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/15748f24-acfa-4061-8174-a03a894713c0n%40googlegroups.com
>> 
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAGabyPpMUwvzgV3z9W1D7R8%3D%3DWS0jW1Vh0doJQ0Ed0LshhzUbA%40mail.gmail.com
> 
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/6C5DBC9E-4CBE-4672-913A-B2FD35CD1CF0%40ix.netcom.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEpB38NCAAwOn2B0VgvM3iV%3DqyLqdiXxpPHM9GDmeje%2Bq2KaWg%40mail.gmail.com.


Re: [go-nuts] How can I use go with Modules

2022-12-02 Thread TheDiveO
My 2cents here. One of the most terrible examples of pre-mod repos I've 
encountered are Docker's engine repos, subsuming also the repos moved into 
the moby realm: they mostly lack module information and they break upon 
checking them out on master or go getting them and trying to build, even on 
a specific release tag. Trying to use them as a dependency is also a pain 
because you need to check the vendoring of the moby main repo in order to 
pin the precise dependencies you'll need. The only exception is the Docker 
API client ... it is a proper mod.

I only started working with Go in a serious and professional manner in my 
paid company work after modules were finally to settle at 1.12/1.13. 
Without modules I weren't using Go even to toy programming. Paint me a 
happy Gopher, more so as workspaces finally make working on multiple 
modules in lock step possible.

On Thursday, December 1, 2022 at 7:33:49 PM UTC+1 chri...@aperture.us wrote:

> Hi Jason,
>
> Your sentiment is understandable and was shared by many of us when modules 
> were first announced.
>
>  ..however..
>
> The points you're making here have been proven to be moot with modules in 
> the meantime. here's why;
>
> You can still clone a go repository anywhere you want and run the examples 
> / edit them. If you want to override dependencies you can use a go.work 
> file in the parent directory of the git repositories and clone the other 
> dependencies you want to override to that directory.
>
> So there's no reason to hate on go modules anymore and almost all projects 
> use it today.
>
> Please explain why you find downloading a fork of a repo more time 
> consuming with this approach and we will help explain how to do it quickly.
>
> Best regards,
> Christian
>
> On Thu, Dec 1, 2022, 9:12 AM Jason Bramsden  
> wrote:
>
>> BLUF: Is there any way to use the latest version of Go without Modules? 
>> Some flag or environment setting where I can disable it?
>>
>> I've been developing on Go since 2011, and I find Modules so frustrating! 
>> Life was so much easier without Modules, I could download packages from a 
>> git repo using go get, and they would be accessible in the go/src 
>> directory. I could then easily run the examples code and make changes all 
>> in a nice directory structure.  I don't care about what version the code is 
>> at, which makes Modules pointless for the way that I develop.
>>
>> With Modules, if I'm downloading a fork of a git repo, then it is so much 
>> more time-consuming, especially if the 3rd party fork code has issues. 
>>
>> I could go back to an earlier version of the Go or I could switch to 
>> another compiler like TinyGo. 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/23540c6b-f0fe-4bed-9bc4-713965306257n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/603b278e-898b-4a97-893b-caf04a36c8fdn%40googlegroups.com.


[go-nuts] Re: [ANN] new linter for "mixed pointer and value receivers"

2022-12-02 Thread TheDiveO
IMHO it might be of broader use to lint the cases where a value receiver is 
used and there are assignments to it or its fields ... or is this already 
caught by ineffassign? The recommendation leads to slightly "ugly" 
situations on a regular basis to enforce a pointer receiver on the Stringer 
method just for the sake of symmetry. Or am I misunderstanding this?

On Thursday, December 1, 2022 at 11:33:50 AM UTC+1 nikolay.d...@gmail.com 
wrote:

> *what?*
>
> New go vet compatible linter that detects mixing pointer and value method 
> receivers for the same type.
>
> https://github.com/nikolaydubina/smrcptr
>
> *why?*
>
> It is recommended in Go wiki and in Google Go style guide. It is very 
> common principle to keep code clean in practice and code reviews. Yet, 
> there is no open source linter for this.
>
> Thank you! ‍♂️
>
> -- Nikolay
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8b0b2aa2-eb9e-4795-b9b6-d9605486d2f2n%40googlegroups.com.


Re: [go-nuts] gRPC for web applications with millions of users

2022-12-02 Thread robert engels
There are also things like https://github.com/grpc/grpc-web

> On Dec 2, 2022, at 11:20 AM, 'Sean Liao' via golang-nuts 
>  wrote:
> 
> See also https://buf.build/blog/connect-web-protobuf-grpc-in-the-browser 
> 
> 
> - sean
> 
> 
> On Fri, Dec 2, 2022 at 4:46 PM Brian Candler  > wrote:
> Just checking that you came across this already?
> https://grpc.io/blog/state-of-grpc-web/ 
> 
> 
> gRPC can't be implemented natively in browsers. You can sending something 
> gRPC-like and then convert it back to gRPC at the server.  But for 
> bi-directional streaming, I think you need to look at Websockets or 
> Server-Sent Events.
> 
> On Friday, 2 December 2022 at 14:06:34 UTC Sankar wrote:
> Hi,
> 
> I have used gRPC for some simple applications, where the server is in Golang 
> and the client is also another golang application. I have primarily worked in 
> the backend and have done a lot of gRPC communication among the backend 
> services using the likes of gRPC streams and golang.
> 
> Now for the first time, I am trying to implement a web application. The 
> client apps will be done in react-native. So I was thinking of using the 
> javascript gen code for the client libraries.
> 
> However I read from some blogposts, when I searched for how to use gRPC in 
> javascript, I read that gRPC cannot be used for consumer facing applications 
> and is only fit for backend applications. I read that grpc streaming will not 
> work with Browser based applications.
> 
> Also I read that gRPC will not scale if there are millions of user requests 
> coming from browsers. I am sure that gRPC can handle a lot of backend volume, 
> but I have not used with a lot of parallel connections. 
> 
> So I wanted to ask, if gRPC is used by any consumer facing applications, 
> where the backend  is done in Go and the front end is done in some form of 
> javascript framework, with a few million users.
> 
> Any feedback, suggestions, links, etc. on this topic are also welcome.
> 
> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/15748f24-acfa-4061-8174-a03a894713c0n%40googlegroups.com
>  
> .
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAGabyPpMUwvzgV3z9W1D7R8%3D%3DWS0jW1Vh0doJQ0Ed0LshhzUbA%40mail.gmail.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6C5DBC9E-4CBE-4672-913A-B2FD35CD1CF0%40ix.netcom.com.


Re: [go-nuts] Re: gRPC for web applications with millions of users

2022-12-02 Thread 'Sean Liao' via golang-nuts
See also https://buf.build/blog/connect-web-protobuf-grpc-in-the-browser

- sean


On Fri, Dec 2, 2022 at 4:46 PM Brian Candler  wrote:

> Just checking that you came across this already?
> https://grpc.io/blog/state-of-grpc-web/
>
> gRPC can't be implemented natively in browsers. You can sending something
> gRPC-like and then convert it back to gRPC at the server.  But for
> bi-directional streaming, I think you need to look at Websockets or
> Server-Sent Events.
>
> On Friday, 2 December 2022 at 14:06:34 UTC Sankar wrote:
>
>> Hi,
>>
>> I have used gRPC for some simple applications, where the server is in
>> Golang and the client is also another golang application. I have primarily
>> worked in the backend and have done a lot of gRPC communication among the
>> backend services using the likes of gRPC streams and golang.
>>
>> Now for the first time, I am trying to implement a web application. The
>> client apps will be done in react-native. So I was thinking of using the
>> javascript gen code for the client libraries.
>>
>> However I read from some blogposts, when I searched for how to use gRPC
>> in javascript, I read that gRPC cannot be used for consumer facing
>> applications and is only fit for backend applications. I read that grpc
>> streaming will not work with Browser based applications.
>>
>> Also I read that gRPC will not scale if there are millions of user
>> requests coming from browsers. I am sure that gRPC can handle a lot of
>> backend volume, but I have not used with a lot of parallel connections.
>>
>> So I wanted to ask, if gRPC is used by any consumer facing applications,
>> where the backend  is done in Go and the front end is done in some form of
>> javascript framework, with a few million users.
>>
>> Any feedback, suggestions, links, etc. on this topic are also welcome.
>>
>> Thanks.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/15748f24-acfa-4061-8174-a03a894713c0n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGabyPpMUwvzgV3z9W1D7R8%3D%3DWS0jW1Vh0doJQ0Ed0LshhzUbA%40mail.gmail.com.


Re: [go-nuts] Fetch pseudo-versions

2022-12-02 Thread 'Sean Liao' via golang-nuts
all pseudoversions would be a list of all commits
are you sure that's what you want?

- sean

On Fri, Dec 2, 2022, 16:37 Marco Augusto Vitangeli <
marcoaugustovitang...@gmail.com> wrote:

> Hi, this question is a little bit weird, but for a project I need to list
> all versions of a golang package. Currently I'm doing it with the golang
> proxy, and the list endpoint, but it has one issue, it does not return
> pseudo versions. Do you have any idea o how can I access this information?
> some registry that I can fetch it or something. Thank you in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/efe227f2-7fd3-49c6-bd7e-0a271e91bad6n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGabyPokRVwAh5QkF6GrbR1%3DjySGz4C56aW9W6vi4qdLbo5MmA%40mail.gmail.com.


[go-nuts] Re: gRPC for web applications with millions of users

2022-12-02 Thread Brian Candler
Just checking that you came across this already?
https://grpc.io/blog/state-of-grpc-web/

gRPC can't be implemented natively in browsers. You can sending something 
gRPC-like and then convert it back to gRPC at the server.  But for 
bi-directional streaming, I think you need to look at Websockets or 
Server-Sent Events.

On Friday, 2 December 2022 at 14:06:34 UTC Sankar wrote:

> Hi,
>
> I have used gRPC for some simple applications, where the server is in 
> Golang and the client is also another golang application. I have primarily 
> worked in the backend and have done a lot of gRPC communication among the 
> backend services using the likes of gRPC streams and golang.
>
> Now for the first time, I am trying to implement a web application. The 
> client apps will be done in react-native. So I was thinking of using the 
> javascript gen code for the client libraries.
>
> However I read from some blogposts, when I searched for how to use gRPC in 
> javascript, I read that gRPC cannot be used for consumer facing 
> applications and is only fit for backend applications. I read that grpc 
> streaming will not work with Browser based applications.
>
> Also I read that gRPC will not scale if there are millions of user 
> requests coming from browsers. I am sure that gRPC can handle a lot of 
> backend volume, but I have not used with a lot of parallel connections. 
>
> So I wanted to ask, if gRPC is used by any consumer facing applications, 
> where the backend  is done in Go and the front end is done in some form of 
> javascript framework, with a few million users.
>
> Any feedback, suggestions, links, etc. on this topic are also welcome.
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/15748f24-acfa-4061-8174-a03a894713c0n%40googlegroups.com.


[go-nuts] Fetch pseudo-versions

2022-12-02 Thread Marco Augusto Vitangeli
Hi, this question is a little bit weird, but for a project I need to list 
all versions of a golang package. Currently I'm doing it with the golang 
proxy, and the list endpoint, but it has one issue, it does not return 
pseudo versions. Do you have any idea o how can I access this information? 
some registry that I can fetch it or something. Thank you in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/efe227f2-7fd3-49c6-bd7e-0a271e91bad6n%40googlegroups.com.


Re: [go-nuts] Go Memory Model question

2022-12-02 Thread burak serdar
The way I read the memory model, this program can print 01, 00, and 11, but
not 10. This is because goroutine creation creates a synchronized before
relationship between x=1 and x=0, so even though there is a race, x=0
happens before x=1.

On Fri, Dec 2, 2022 at 6:56 AM のびしー  wrote:

> > I believe your example is basically equivalent to the ones in
> https://go.dev/ref/mem#badsync which also contains an explanation of how
> the memory model implies this
>
> @Wagner
> Thanks for your opinion, I think so too. I was not confident that my
> example is equivalent to https://go.dev/ref/mem#badsync, since my example
> reads from the same variable.
>
>
> > Programs that modify data being simultaneously accessed by multiple
> goroutines must serialize such access.
> @peterGo
>
> I know that my example has data races. But the Go Memory Model guarantees
> a limited number of outcomes for programs with races(unless runtime reports
> the race and terminates). My question is about the limited outcomes.
>
> 2022年12月2日(金) 22:02 Axel Wagner :
>
>> I believe your example is basically equivalent to the ones in
>> https://go.dev/ref/mem#badsync which also contains an explanation of how
>> the memory model implies this (or rather, how it does not imply the
>> opposite).
>>
>> On Fri, Dec 2, 2022, 13:11 のびしー  wrote:
>>
>>> Hello, I have another question regarding the Go Memory Model.
>>>
>>> (1) Can this program print "10", according to the Memory Model?
>>> (2) If that is forbidden, which part of the Go Memory Model excludes
>>> such behavior?
>>>
>>> https://go.dev/play/p/Fn5I0fjSiKj
>>>
>>> ```go
>>> package main
>>>
>>> var x int = 0
>>>
>>> func main() {
>>> go func() {
>>> x = 1
>>> }()
>>> print(x) // first read: 1
>>> print(x) // second read: 0
>>> }
>>> ```
>>>
>>> I draw a picture of the happens-before relation of this program here:
>>>
>>>
>>> https://gist.github.com/nobishino/8150346c30101e2ca409ed83c6c25add?permalink_comment_id=4388680#gistcomment-4388680
>>>
>>> I think the answer to (1) is yes.
>>> Both reads are concurrent with x = 1, so each read can observe both x =
>>> 0 and x = 1.
>>> And there is no constraint between the results of the first read and the
>>> second read.
>>> So the second read can observe x = 0 even if the first read observes x =
>>> 0.
>>>
>>> But I'm not very sure. Is this understanding correct?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/CAGoET5HyPxEhBETGWNPuYpDgXbm0JM3jeaKFdoQdtc5eGUR0Uw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAGoET5Fk6Wwd7JOJOY%3DJVix9NymsP3yJ_P%2BaDPgtPTorL-X_Wg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMV2Rqphhx8S0sZDv%3Dj1rskhPvCBstzLo%2BAscz5X7pMnNFzWNQ%40mail.gmail.com.


[go-nuts] gRPC for web applications with millions of users

2022-12-02 Thread Sankar
Hi,

I have used gRPC for some simple applications, where the server is in 
Golang and the client is also another golang application. I have primarily 
worked in the backend and have done a lot of gRPC communication among the 
backend services using the likes of gRPC streams and golang.

Now for the first time, I am trying to implement a web application. The 
client apps will be done in react-native. So I was thinking of using the 
javascript gen code for the client libraries.

However I read from some blogposts, when I searched for how to use gRPC in 
javascript, I read that gRPC cannot be used for consumer facing 
applications and is only fit for backend applications. I read that grpc 
streaming will not work with Browser based applications.

Also I read that gRPC will not scale if there are millions of user requests 
coming from browsers. I am sure that gRPC can handle a lot of backend 
volume, but I have not used with a lot of parallel connections. 

So I wanted to ask, if gRPC is used by any consumer facing applications, 
where the backend  is done in Go and the front end is done in some form of 
javascript framework, with a few million users.

Any feedback, suggestions, links, etc. on this topic are also welcome.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/62b922a6-f86c-4960-81d4-d61b86df7f46n%40googlegroups.com.


Re: [go-nuts] Go Memory Model question

2022-12-02 Thread のびしー
> I believe your example is basically equivalent to the ones in
https://go.dev/ref/mem#badsync which also contains an explanation of how
the memory model implies this

@Wagner
Thanks for your opinion, I think so too. I was not confident that my
example is equivalent to https://go.dev/ref/mem#badsync, since my example
reads from the same variable.


> Programs that modify data being simultaneously accessed by multiple
goroutines must serialize such access.
@peterGo

I know that my example has data races. But the Go Memory Model guarantees a
limited number of outcomes for programs with races(unless runtime reports
the race and terminates). My question is about the limited outcomes.

2022年12月2日(金) 22:02 Axel Wagner :

> I believe your example is basically equivalent to the ones in
> https://go.dev/ref/mem#badsync which also contains an explanation of how
> the memory model implies this (or rather, how it does not imply the
> opposite).
>
> On Fri, Dec 2, 2022, 13:11 のびしー  wrote:
>
>> Hello, I have another question regarding the Go Memory Model.
>>
>> (1) Can this program print "10", according to the Memory Model?
>> (2) If that is forbidden, which part of the Go Memory Model excludes such
>> behavior?
>>
>> https://go.dev/play/p/Fn5I0fjSiKj
>>
>> ```go
>> package main
>>
>> var x int = 0
>>
>> func main() {
>> go func() {
>> x = 1
>> }()
>> print(x) // first read: 1
>> print(x) // second read: 0
>> }
>> ```
>>
>> I draw a picture of the happens-before relation of this program here:
>>
>>
>> https://gist.github.com/nobishino/8150346c30101e2ca409ed83c6c25add?permalink_comment_id=4388680#gistcomment-4388680
>>
>> I think the answer to (1) is yes.
>> Both reads are concurrent with x = 1, so each read can observe both x = 0
>> and x = 1.
>> And there is no constraint between the results of the first read and the
>> second read.
>> So the second read can observe x = 0 even if the first read observes x =
>> 0.
>>
>> But I'm not very sure. Is this understanding correct?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/CAGoET5HyPxEhBETGWNPuYpDgXbm0JM3jeaKFdoQdtc5eGUR0Uw%40mail.gmail.com
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGoET5Fk6Wwd7JOJOY%3DJVix9NymsP3yJ_P%2BaDPgtPTorL-X_Wg%40mail.gmail.com.


Re: [go-nuts] Go Memory Model question

2022-12-02 Thread 'Axel Wagner' via golang-nuts
I believe your example is basically equivalent to the ones in
https://go.dev/ref/mem#badsync which also contains an explanation of how
the memory model implies this (or rather, how it does not imply the
opposite).

On Fri, Dec 2, 2022, 13:11 のびしー  wrote:

> Hello, I have another question regarding the Go Memory Model.
>
> (1) Can this program print "10", according to the Memory Model?
> (2) If that is forbidden, which part of the Go Memory Model excludes such
> behavior?
>
> https://go.dev/play/p/Fn5I0fjSiKj
>
> ```go
> package main
>
> var x int = 0
>
> func main() {
> go func() {
> x = 1
> }()
> print(x) // first read: 1
> print(x) // second read: 0
> }
> ```
>
> I draw a picture of the happens-before relation of this program here:
>
>
> https://gist.github.com/nobishino/8150346c30101e2ca409ed83c6c25add?permalink_comment_id=4388680#gistcomment-4388680
>
> I think the answer to (1) is yes.
> Both reads are concurrent with x = 1, so each read can observe both x = 0
> and x = 1.
> And there is no constraint between the results of the first read and the
> second read.
> So the second read can observe x = 0 even if the first read observes x = 0.
>
> But I'm not very sure. Is this understanding correct?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAGoET5HyPxEhBETGWNPuYpDgXbm0JM3jeaKFdoQdtc5eGUR0Uw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfHj72RXfHivHKfcQYF%2BgiZv4WGP_v9jhZDucR0n1PRU4Q%40mail.gmail.com.


[go-nuts] Re: Go Memory Model question

2022-12-02 Thread peterGo
Programs that modify data being simultaneously accessed by multiple 
goroutines must serialize such access.   
https://go.dev/ref/mem   

$ go run -race racer.go
00
==
WARNING: DATA RACE
Write at 0x0054d5f8 by goroutine 6:
  main.main.func1()
  /home/peter/racer.go:7 +0x29

Previous read at 0x0054d5f8 by main goroutine:
  main.main()
  /home/peter/racer.go:9 +0x3c

Goroutine 6 (running) created at:
  main.main()
  /home/peter/racer.go:6 +0x30
==
Found 1 data race(s)
exit status 66
$ 

peter

On Friday, December 2, 2022 at 7:13:09 AM UTC-5 nobis...@gmail.com wrote:

> > So the second read can observe x = 0 even if the first read observes x = 
> 0.
>
> Sorry, I meant "So the second read can observe x = 0 even if the first 
> read observes x = 1." here.
>
> 2022年12月2日(金) 21:10 のびしー :
>
>> Hello, I have another question regarding the Go Memory Model. 
>>
>> (1) Can this program print "10", according to the Memory Model?
>> (2) If that is forbidden, which part of the Go Memory Model excludes such 
>> behavior?
>>
>> https://go.dev/play/p/Fn5I0fjSiKj
>>
>> ```go
>> package main
>>
>> var x int = 0
>>
>> func main() {
>> go func() {
>> x = 1
>> }()
>> print(x) // first read: 1
>> print(x) // second read: 0
>> }
>> ```
>>
>> I draw a picture of the happens-before relation of this program here:
>>
>>
>> https://gist.github.com/nobishino/8150346c30101e2ca409ed83c6c25add?permalink_comment_id=4388680#gistcomment-4388680
>>
>> I think the answer to (1) is yes. 
>> Both reads are concurrent with x = 1, so each read can observe both x = 0 
>> and x = 1.
>> And there is no constraint between the results of the first read and the 
>> second read.
>> So the second read can observe x = 0 even if the first read observes x = 
>> 0.
>>
>> But I'm not very sure. Is this understanding correct?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6fae3e5e-2a09-4d54-82aa-54b2ef9a3a8cn%40googlegroups.com.


[go-nuts] Re: Go Memory Model question

2022-12-02 Thread のびしー
> So the second read can observe x = 0 even if the first read observes x =
0.

Sorry, I meant "So the second read can observe x = 0 even if the first read
observes x = 1." here.

2022年12月2日(金) 21:10 のびしー :

> Hello, I have another question regarding the Go Memory Model.
>
> (1) Can this program print "10", according to the Memory Model?
> (2) If that is forbidden, which part of the Go Memory Model excludes such
> behavior?
>
> https://go.dev/play/p/Fn5I0fjSiKj
>
> ```go
> package main
>
> var x int = 0
>
> func main() {
> go func() {
> x = 1
> }()
> print(x) // first read: 1
> print(x) // second read: 0
> }
> ```
>
> I draw a picture of the happens-before relation of this program here:
>
>
> https://gist.github.com/nobishino/8150346c30101e2ca409ed83c6c25add?permalink_comment_id=4388680#gistcomment-4388680
>
> I think the answer to (1) is yes.
> Both reads are concurrent with x = 1, so each read can observe both x = 0
> and x = 1.
> And there is no constraint between the results of the first read and the
> second read.
> So the second read can observe x = 0 even if the first read observes x = 0.
>
> But I'm not very sure. Is this understanding correct?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGoET5GrXu9ibhvtqffWw1rD5LbeqNHR%3D5TD2r8nQ6WHHZ%2Batg%40mail.gmail.com.


[go-nuts] Go Memory Model question

2022-12-02 Thread のびしー
Hello, I have another question regarding the Go Memory Model.

(1) Can this program print "10", according to the Memory Model?
(2) If that is forbidden, which part of the Go Memory Model excludes such
behavior?

https://go.dev/play/p/Fn5I0fjSiKj

```go
package main

var x int = 0

func main() {
go func() {
x = 1
}()
print(x) // first read: 1
print(x) // second read: 0
}
```

I draw a picture of the happens-before relation of this program here:

https://gist.github.com/nobishino/8150346c30101e2ca409ed83c6c25add?permalink_comment_id=4388680#gistcomment-4388680

I think the answer to (1) is yes.
Both reads are concurrent with x = 1, so each read can observe both x = 0
and x = 1.
And there is no constraint between the results of the first read and the
second read.
So the second read can observe x = 0 even if the first read observes x = 0.

But I'm not very sure. Is this understanding correct?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGoET5HyPxEhBETGWNPuYpDgXbm0JM3jeaKFdoQdtc5eGUR0Uw%40mail.gmail.com.