Multiple processes in parallel for cgo service

252 views
Skip to first unread message

Nitish Saboo

unread,
Dec 5, 2019, 5:40:38 AM12/5/19
to golang-nuts
Hi,

I am having a cgo(go + c) service.Is it possible to run multiple processes of the same service in parallel ?

Thanks,
Nitish

Ian Lance Taylor

unread,
Dec 6, 2019, 12:41:58 AM12/6/19
to Nitish Saboo, golang-nuts
On Thu, Dec 5, 2019 at 2:41 AM Nitish Saboo <nitish....@gmail.com> wrote:
>
> I am having a cgo(go + c) service.Is it possible to run multiple processes of the same service in parallel ?

Well, it depends on what the service does. But there is nothing in
the Go tools or standard library that prevents you from doing this.

Ian

Nitish Saboo

unread,
Dec 6, 2019, 3:15:22 AM12/6/19
to Ian Lance Taylor, golang-nuts
Hi Ian,

The Go code fetches a message from SQS and calls the C code to parse the log messages.So this is what the cgo service does.
I would like to run the same service on different processes independently. I am not sure how to achieve this in Go. Can you please guide me here.

Thanks,
Nitish

Brian Candler

unread,
Dec 6, 2019, 3:21:46 PM12/6/19
to golang-nuts
Can you just run multiple instances of your program, each independently fetching messages from SQS?

Nitish Saboo

unread,
Dec 7, 2019, 9:34:19 AM12/7/19
to Brian Candler, golang-nuts
Hi Brian,

I understand by running the service as containers is one route through which we can achieve this.
My query is if I want to avoid that route , is there a way to achieve this using Go code to define multiple instance and run them independently?

Thanks,
Nitish

On Sat, Dec 7, 2019 at 1:52 AM Brian Candler <b.ca...@pobox.com> wrote:
Can you just run multiple instances of your program, each independently fetching messages from SQS?

--
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/36c64d89-c8bf-4595-8fc3-fdc11a8b315b%40googlegroups.com.

Jake Montgomery

unread,
Dec 7, 2019, 10:22:06 AM12/7/19
to golang-nuts
Nitish,

   I don't think you really explained the problem you are having. There is nothing in go that prevents you from running multiple instances of an executable, hence creating multiple processes running the same program. You can simply open two console windows and start the same long running go executable in each. So without more information your question seems like a trivial "yes".

   Of course. if your program (service) uses a shared resource, such as listening on a specific ip and port, then you could have a contention problem. But to solve that would require specifics of your service, and the problem you are having getting two of them to run at the same time.

- Jake


On Saturday, December 7, 2019 at 9:34:19 AM UTC-5, Nitish Saboo wrote:
Hi Brian,

I understand by running the service as containers is one route through which we can achieve this.
My query is if I want to avoid that route , is there a way to achieve this using Go code to define multiple instance and run them independently?

Thanks,
Nitish

On Sat, Dec 7, 2019 at 1:52 AM Brian Candler <b.ca...@pobox.com> wrote:
Can you just run multiple instances of your program, each independently fetching messages from SQS?

--
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 golan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages