- Wizard is a Go library that provides database partitioning and sharding capabilities. It supports vertical partitioning, horizontal sharding, and works with the XORM ORM. Users initialize a Wizard engine with database connections, create clusters, and get sessions from Wizard to execute queries across shards.
Elasticsearch sur Azure : Make sense of your (BIG) data !Microsoft
Sous licence Apache2, elasticsearch est un moteur de recherche puissant, distribué et scalable. Il fournit également des agrégations en temps réel en fonction de vos besoins. Couplé à Kibana, dashboard générique et hautement personnalisable, il vous permet de donner immédiatement du sens à vos données. En forte progression au niveau de son adhésion par les entreprises et les sites publics, découvrez ce que sont elasticsearch et Kibana et à quel point il est simple de les déployer facilement sur la plate-forme Windows Azure. Thomas et David illustreront à l'aide de cas clients les bénéfices obtenus à travers ces solutions.
Speakers : Thomas Conté (Microsoft), David Pilato (Elasticsearch)
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...MongoDB
This will cover what to consider for high write throughput performance from hardware configuration through to the use of replica sets, multi-data centre deployments, monitoring and sharding to ensure your database is fast and stays online.
Running a Realtime Stats Service on MySQLKazuho Oku
Slides used at Percona Performance Conference. Describes the optimizations / tweeks used on running pathtraq.com, one of Japan's largest web stats service.
Amazon Aurora is a MySQL-compatible database engine that combines the speed and availability of high-end commercial databases with the simplicity and cost-effectiveness of open source databases. This session introduces you to Amazon Aurora, explains common use cases for the service, and helps you get started with building your first Amazon Aurora–powered application.
MongoDB: Optimising for Performance, Scale & AnalyticsServer Density
MongoDB is easy to download and run locally but requires some thought and further understanding when deploying to production. At scale, schema design, indexes and query patterns really matter. So does data structure on disk, sharding, replication and data centre awareness. This talk will examine these factors in the context of analytics, and more generally, to help you optimise MongoDB for any scale.
Presented at MongoDB Days London 2013 by David Mytton.
Improve your SQL workload with observabilityOVHcloud
La majeure partie du SI d'OVH repose sur des bases de données relationnelles (PostgreSQL, MySQL, MariaDB). En termes de volumétrie cela représente 400 bases pesants plus de 20To de données réparties sur 60 clusters dans deux zones géographiques le tout propulsant 3000 applications.
Comment tout voir dans notre parc ? Mieux encore, comment faire pour que tout le monde puisse suivre l'activité de sa base de données ? C'est le challenge que nous nous sommes fixés, un an après nous pouvons partager notre expérience.
Et si l'observability n'était pas juste un buzzword, mais avait un réel impact sur la production ?
Elasticsearch sur Azure : Make sense of your (BIG) data !Microsoft
Sous licence Apache2, elasticsearch est un moteur de recherche puissant, distribué et scalable. Il fournit également des agrégations en temps réel en fonction de vos besoins. Couplé à Kibana, dashboard générique et hautement personnalisable, il vous permet de donner immédiatement du sens à vos données. En forte progression au niveau de son adhésion par les entreprises et les sites publics, découvrez ce que sont elasticsearch et Kibana et à quel point il est simple de les déployer facilement sur la plate-forme Windows Azure. Thomas et David illustreront à l'aide de cas clients les bénéfices obtenus à travers ces solutions.
Speakers : Thomas Conté (Microsoft), David Pilato (Elasticsearch)
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...MongoDB
This will cover what to consider for high write throughput performance from hardware configuration through to the use of replica sets, multi-data centre deployments, monitoring and sharding to ensure your database is fast and stays online.
Running a Realtime Stats Service on MySQLKazuho Oku
Slides used at Percona Performance Conference. Describes the optimizations / tweeks used on running pathtraq.com, one of Japan's largest web stats service.
Amazon Aurora is a MySQL-compatible database engine that combines the speed and availability of high-end commercial databases with the simplicity and cost-effectiveness of open source databases. This session introduces you to Amazon Aurora, explains common use cases for the service, and helps you get started with building your first Amazon Aurora–powered application.
MongoDB: Optimising for Performance, Scale & AnalyticsServer Density
MongoDB is easy to download and run locally but requires some thought and further understanding when deploying to production. At scale, schema design, indexes and query patterns really matter. So does data structure on disk, sharding, replication and data centre awareness. This talk will examine these factors in the context of analytics, and more generally, to help you optimise MongoDB for any scale.
Presented at MongoDB Days London 2013 by David Mytton.
Improve your SQL workload with observabilityOVHcloud
La majeure partie du SI d'OVH repose sur des bases de données relationnelles (PostgreSQL, MySQL, MariaDB). En termes de volumétrie cela représente 400 bases pesants plus de 20To de données réparties sur 60 clusters dans deux zones géographiques le tout propulsant 3000 applications.
Comment tout voir dans notre parc ? Mieux encore, comment faire pour que tout le monde puisse suivre l'activité de sa base de données ? C'est le challenge que nous nous sommes fixés, un an après nous pouvons partager notre expérience.
Et si l'observability n'était pas juste un buzzword, mais avait un réel impact sur la production ?
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Welocme to ViralQR, your best QR code generator.ViralQR
Welcome to ViralQR, your best QR code generator available on the market!
At ViralQR, we design static and dynamic QR codes. Our mission is to make business operations easier and customer engagement more powerful through the use of QR technology. Be it a small-scale business or a huge enterprise, our easy-to-use platform provides multiple choices that can be tailored according to your company's branding and marketing strategies.
Our Vision
We are here to make the process of creating QR codes easy and smooth, thus enhancing customer interaction and making business more fluid. We very strongly believe in the ability of QR codes to change the world for businesses in their interaction with customers and are set on making that technology accessible and usable far and wide.
Our Achievements
Ever since its inception, we have successfully served many clients by offering QR codes in their marketing, service delivery, and collection of feedback across various industries. Our platform has been recognized for its ease of use and amazing features, which helped a business to make QR codes.
Our Services
At ViralQR, here is a comprehensive suite of services that caters to your very needs:
Static QR Codes: Create free static QR codes. These QR codes are able to store significant information such as URLs, vCards, plain text, emails and SMS, Wi-Fi credentials, and Bitcoin addresses.
Dynamic QR codes: These also have all the advanced features but are subscription-based. They can directly link to PDF files, images, micro-landing pages, social accounts, review forms, business pages, and applications. In addition, they can be branded with CTAs, frames, patterns, colors, and logos to enhance your branding.
Pricing and Packages
Additionally, there is a 14-day free offer to ViralQR, which is an exceptional opportunity for new users to take a feel of this platform. One can easily subscribe from there and experience the full dynamic of using QR codes. The subscription plans are not only meant for business; they are priced very flexibly so that literally every business could afford to benefit from our service.
Why choose us?
ViralQR will provide services for marketing, advertising, catering, retail, and the like. The QR codes can be posted on fliers, packaging, merchandise, and banners, as well as to substitute for cash and cards in a restaurant or coffee shop. With QR codes integrated into your business, improve customer engagement and streamline operations.
Comprehensive Analytics
Subscribers of ViralQR receive detailed analytics and tracking tools in light of having a view of the core values of QR code performance. Our analytics dashboard shows aggregate views and unique views, as well as detailed information about each impression, including time, device, browser, and estimated location by city and country.
So, thank you for choosing ViralQR; we have an offer of nothing but the best in terms of QR code services to meet business diversity!
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
8. 2017.01
2016.01
2016.09
2015.05
Our History
"Couples" gets over 4 million
downloads.
"Pairs" gets over 5 million user
and 32 million matchings.
Junya Ishibashi is elected CEO,
succeeding Yu Akasaka, who
retained chairman title.
IAC/InterActiveCorp acquires
eureka.
2014.06
2014.05
2013.10
2012.10
2011.09
2010.08
2008.11
"Pairs" gets over 1 million user
and 3.3 million matchings.
eureka launches communication
app for couple, "Couples".
eureka launches online-dating
service "Pairs" in Taiwan.
eureka launches online-dating
service "Pairs" in Japan.
eureka starts smartphone and
Facebook app services.
eureka starts blog marketing
services.
eureka is founded in Tokyo.
14. One day, on very sunny day morning...
あるよく晴れた日の朝...
15. Mr. Me (alias)
私さん(仮名)
ʕº̫͡ºʔ
Note: All characters and stories are fictitious examples
※ 登場人物・話は全て架空の例です
Mr. Boss (alias)
ボス(仮名)
ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
16. One day, on very sunny day morning… (2014, Winter)
ʕº̫͡ºʔ< "Awesome weather today, huh!"
(うーん、今日もいい天気)
ʕº̫͡ºʔ< "Nothing beats Golang on a day like this."
(こんな日はGoに限る)
ʕº̫͡ºʔ< "Alright, let’s write some codes."
(よーし、今日も仕事しちゃうぞ)
17. "Hi, Mr. Me" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(私さん)
"I have something to tell you..." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(ちょっと話があるんですが...)
One day, on very sunny day morning… (2014, Winter)
18. One day, on very sunny day morning… (2014, Winter)
ʕº̫͡ºʔ< "What's the matter?"
(え、なんでしょうか)
ʕº̫͡ºʔo0O (Something smells fishey...)
(これは危険なニオイがするぞ...)
19. One day, on very sunny day morning… (2014, Winter)
"About the next golang project," >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(Goフルスクラッチに際して)
"We needs some kind of database shardings,
right?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(DBシャーディング必要じゃないですか?)
20. One day, on very sunny day morning… (2014, Winter)
ʕº̫͡ºʔ< "Ah, well..."
(あー、そうですね。。。)
ʕº̫͡ºʔ< "But there isn’t such library in golang."
(でもちょっと探してみた限りシャーディング対応したライブラリなさそうなんですよ
ね。)
ʕº̫͡ºʔ< "I think it’s better to do it using some
middleware for MySQL"
(やっぱミドルウェア側でやるしかないんじゃないですかね)
21. One day, on very sunny day morning… (2014, Winter)
"Hmmmmm, whatever" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(ふーん)
"You should fix the details and
add it to the schedule." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(まあいいけどちゃんと詳細決めて見積もり入れておいてくださいよ)
22. One day, on very sunny day morning… (2014, Winter)
ʕº̫͡ºʔ< "Roger, sir!"
(ラジャー!)
"..." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(He replies cheerfully, but never keeps a schedule.)
O0oʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(返事だけはいつも調子いいからけどスケジュール全く守らないからな、
こいつ...)
24. 3 Months Later (Spring)
"Hi, Mr. Me" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(私さん)
"What’s going on the sharding?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(シャーディングの件どうなってます?)
25. 3 Months Later (Spring)
ʕº̫͡ºʔ< "Ah, sharding! Well..."
(あーその件ですね。。。)
"Did you consider about it seriously?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(ちゃんと考えてました?)
ʕº̫͡ºʔo0O (he-he! Gotcha!)
(ふはは、かかったなバカめ!)
26. 3 Months Later (Spring)
ʕº̫͡ºʔ< "Let’s try to use Vitess by Youtube."
(YoutubeのVitess使いましょう)
"What?!?!" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(は?!?!)
ʕº̫͡ºʔ< "Trust yourself."
(我々なら出来ますよ。自分を信じましょう。)
27. 3 Months Later (Spring)
"Are you sure?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(信じましょうって...)
"It’s just released, right?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(まだ出たばっかですよね?)
"Moreover, don’t you think that
you should maintain it yourself?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(それにあなた、自分で構築・運用する気ないですよね?)
28. 3 Months Later (Spring)
"If use it, you should do it from beginning to the
end." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(Vitess採用するならあなた運用対応してくださいよ)
"I’ll catch you even if you escape." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(決めるだけ決めて逃げたらどこまでも追いかけますからね)
"Right?" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(それでもいいですか?)
29. 3 Months Later (Spring)
ʕº̫͡ºʔo0O (OMG...)
(そんなばかな...)
ʕº̫͡ºʔ< "Just kidding. I have another plan."
(いや、冗談です。実は本当の案があるんです。)
ʕº̫͡ºʔ< "We’ll write golang library for sharding."
(我々でGo言語のライブラリ作ります。)
30. 3 Months Later (Spring)
"Alright. Should’ve said it in the first place" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(はじめからそう言ってください)
"We have 3 months to release," >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(3ヶ月後にはリリースですから)
"You don’t have much time to sleep. Just write code."
>ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(寝てる暇はありませんよ、さあ書きましょう)
33. Another 3 Months Later (Summer)
ʕº̫͡ºʔ< "Phew,"
(ふー)
ʕº̫͡ºʔ< "The release has been postponed and this
library is almost about complete."
(リリースも延期になったし、なんとかライブラリも仕上がりそうだ)
34. Another 3 Months Later (Summer)
"Hi, Mr. Me" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(私さん)
"I have a good news" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(嬉しいお知らせがあります)
"You must be surprised." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(きっと驚きますよ?)
35. Another 3 Months Later (Summer)
ʕº̫͡ºʔ< "What’s the news?"
(どうしたんですか?)
"Listen," >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(実は...)
"AWS Aurora is just released" >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(AWS Auroraがリリースされました)
36. Another 3 Months Later (Summer)
ʕº̫͡ºʔ< "What?!"
(え???)
ʕº̫͡ºʔ (Checking release infomation of AWS Aurora)
(AWS Auroraのリリース情報をチェックする)
37. Another 3 Months Later (Summer)
https://aws.amazon.com/blogs/aws/now-available-amazon-aurora/
38. Another 3 Months Later (Summer)
https://aws.amazon.com/blogs/aws/now-available-amazon-aurora/
NO MORE SHARDING!!
39. Another 3 Months Later (Summer)
"So we don’t need shardings anymore." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(これでもうシャーディングは不要ですね)
"What a peaceful world." >ʕ̡̢̡ʘ̅͟͜͡ ʘ̲̅ ʔ̢̡̢
(いい世の中になりました。)
40. Another 3 Months Later (Summer)
ʕº̫͡ºʔ< "..."
ʕº̫͡ºʔo0O (...)
ʕº̫͡ºʔo0O (I’ll go home and sleep, seriously.)
(今日はもう帰って寝よう...)
41. Another 3 Months Later (Summer)
Chapter 1.
“Tales of Sharding”
~ Fin ~
43. How to use Wizard?
https://github.com/evalphobia/wizard
44. How to use Wizard?
https://github.com/evalphobia/wizard
See README!!
45. How to use Wizard?
Chapter 2.
“How to use”
~ Fin ~
46. How to use Wizard? (Setup Engine)
● 1. Initialize New Engine
- xorm.NewEngine(“mysql”, “user:pass@tcp(0.0.0.0:3306)/dbname”)
● 2. Create New Cluster
- cluster := wizard.NewCluster(engine) // <= register master db
- cluster.RegisterSlave(engine2) // <= register slave db
● 3. Add cluster to new wizard struct
- w := wizard.NewWizard()
- w.SetDefault(cluster)
- ormEngine = wizardxorm.New(w)
47. How to use Wizard? (Get Session)
● 4. Get Session from wizard
- session, err := ormEngine.UseMasterSession(ctx, User{})
● first arg is identifier.
○ Use same identifier, you can get same session.
○ Suit for a series of transaction during the request.
○ e.g.) context.Context, *http.Request
○ Anything is OK!
● second arg is struct for table.
● 5. Execute SQL
- session.Sql("SELECT 1")
50. Code: Setup Engine
var ormEngine wizardORM.ORM
// Initialize database. (Ignore errors for simpleness)
func initNormal() {
// xorm's engine(DB handler)
xormEngine, _ := xorm.NewEngine("mysql", "user:pass@tcp(0.0.0.0:3306)/dbname")
// Create DB Cluster (argument is master DB)
cluster := wizard.NewCluster(xormEngine)
// Create wizard (DB and session handler)
w := wizard.NewWizard()
w.SetDefault(cluster) // set default cluster
ormEngine = wizardxorm.New(w)
}
51. Code: Execute SQL #1 - select to user’s table
// Get User from database.
func sqlGetUser(ctx context.Context, userID int64) (User, error) {
session, _ := ormEngine.UseMasterSession(ctx, &User{})
session.And("user_id = ?", id)
session.ForUpdate() // Lock the row
user := &User{}
_, _ = session.Get(user) //
return user
}
// => SELECT * FROM user WHERE user_id = userID FOR UPDATE;
52. Code: Execute SQL #2 - update user’s table
// Update user’s point
func sqlUpdateUserPoint(ctx context.Context, userID int64, point int64) error {
session, _ := ormEngine.UseMasterSession(ctx, &User{})
session.Cols("point")
session.And("id = ?", userID)
return session.Update(&User{
Point: point,
})
}
// => UPDATE user SET point = point WHERE user_id = userID;
53. Code: Execute SQL #3 - update campaign table
// Update campaign status of the user
func sqlUpdateCampaignStatus(ctx context.Context, userID int64) error {
session, _ := ormEngine.UseMasterSession(ctx, &Campaign{})
session.Cols("status")
session.And("user_id = ?", userID)
return session.Update(&Campaign{
Status: "end",
})
}
// => UPDATE campaign SET status = "end" WHERE user_id = userID;
54. Code: Execute SQL - wrap up
// UPDATE user’s point and complete campaign.
func ExecSQL(ctx context.Context) {
ormEngine.SetAutoTransaction(ctx, true) // start transaction when SQL is executed
userID := 1
u, _ := sqlGetUser(ctx, userID) // => BEGIN and SELECT
_ = sqlUpdateUserPoint(ctx, u.UserID, u.Point + 1) // => UPDATE user
_ = sqlUpdateCampaignStatus(ctx, u.UserID) // => UPDATE campaign
orm.SetAutoTransaction(ctx, false)
err = ormEngine.CommitAll(ctx) // COMMIT
ormEngine.CloseAll(ctx) // Close all sessions
}
55. How to use Shard? (Setup Engine)
● 1. Initialize New Engine
- xorm.NewEngine(“mysql”, “user:pass@tcp(0.0.0.0:3306)/dbname”)
● 2. Create New Clusters
- baseCluster := wizard.NewCluster(engine)
- shardCluster01 := wizard.NewCluster(shardEngineA01)
- shardCluster01.RegisterSlave(shardEngineA02)
- shardCluster02 := wizard.NewCluster(shardEngineB01)
- shardCluster02.RegisterSlave(shardEngineB02)
56. How to use Shard? (Setup Shard Clusters)
● 3. Add clusters to new wizard struct
- w := wizard.NewWizard()
- w.SetDefault(baseCluster)
- // ↑add normal cluster
- shards := w.CreateShardCluster(&UserFavorite{}, 1021)
- shards.RegisterShard(0, 510, shardCluster01)
- shards.RegisterShard(511, 1020, shardCluster02)
- // ↑add shards cluster
- w.RegisterTables(shards, &UserLogin{}, ...)
- // ↑add sharded tables
- ormEngine = wizardxorm.New(w)
57. How to use Shard? (Get Session)
● 4. Get Session from wizard
- session, err := ormEngine.UseMasterSessionByKey(ctx, User{}, key)
● first arg is identifier.
● second arg is struct for table.
● third ard is shard key.
○ e.g. user_id
● 5. Execute SQL
- session.Sql("SELECT 1")
- // ↑ executed on one shard
- ormEngine.FindParallelByCondition([]*User, condition)
- // ↑ executed on all shards
58. Wrap up
● Wizard is DB sharding/session management library
● Only supports xorm
- Send PR!
● eureka use Wizard for production.
● Hard to test...
- Data
- DB instances
- clusters of MySQL/PostgreSQL/etc...
59. CONFIDENTIAL
Thank you
:)
Thank you :)
* Gopher designed by Hinako Sakawa - Original Gopher designed by Renee French.
https://github.com/ohina