Skip to content

A simple app to produce messages to sqs by using aws sdk v2 package for Golang.

Notifications You must be signed in to change notification settings

brenonaraujo/go-sqs-producer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-sqs-producer

A simple app to produce messages to SQS by using aws sdk v2 package for Golang in performatic meaning.

How to run

| go 1.17 or above is required.

Just run the command go run . at the root directory

From docker

Build the image docker build . producer-sqs:snapshot

Execute a docker run docker run -i -d -t -p 8080:9292 -e AWS_ACCESS_KEY_ID=access_key -e AWS_SECRET_ACCESS_KEY=access_secret -e AWS_DEFAULT_REGION=region producer-sqs:snapshot

Sending data to SQS

The service were implemented by using gin as http Router to the api.

  • GET /send/:qtd Generates and send messages async in parallel
  • GET /send/batch/:qtd Generates and send messages in batch of 10 messages each, sapaws a hardcoded number of workers into a pool to fan-out messages to sqs.

Metrics

The server metrics will be at the port 8080, to scrap metrics can simply open the url:

http://localhost:8080/metrics

Performance considerations

| As I told early, /send/batch route implementes a performatic way to send milions of messages to SQS by using goroutines, channels and an worker pool strategy to send messages in batch and parallel, with this we can produce 1000000 (One milion) messages in less than 180 seconds, thats means we can produce 5500 messages per second with that simple implementation of go routines and channels.

working in progress...

About

A simple app to produce messages to sqs by using aws sdk v2 package for Golang.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published