wlminimal
Hi I am using Drab for live updating page.
in commander file
defhandler show_dashboard_stats(socket, sender) do
order_id = sender.params["campaign_id"]
user_id = socket.assigns.current_user_id
order = Sales.get_order_by_id(order_id, user_id)
message_status = Messenger.get_all_message_status(order_id)
total_sent = Enum.count(message_status)
deilvered_count = Analytics.get_delivered_message_status_count(message_status)
undelivered_count = Analytics.get_undelivered_message_status_count(message_status)
bitly = Bitly.get_bitly_by_order_id(order_id)
total_clicks = Analytics.load_clicks(bitly)
IO.puts(" ++++++++++++ poking +++++++++++++")
poke(socket,
total_sent: total_sent,
deilvered_count: deilvered_count,
undelivered_count: undelivered_count,
total_clicks: total_clicks
)
IO.puts("+++++++++++++ poking is done ++++++++++")
socket |> exec_js!("DashboardChart.update()")
end
In local server it tooks less than second. but in production it took more than 5 seconds.
I tried to find where is bottleneck and checked function execution time.
Longest time I measured was 1 second from Analytics.load_clicks(bitly) (this function does external api request)
I added IO.puts function before and after poke. and it took more than 5 seconds to print “poking is done”
I think “poke” is the one cause the problem.
Am I correct?
I deployed in Heroku and using Hobby dynos
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Sounds like Heroku is adding latency. Do you have a URL to your test instance so I can trace the network connection?
grych
It may make sense that the latency of the network increase time from one to five seconds.
@wlminimal, can you measure how long this single poke takes in dev and prod? Just measure the time difference:
wlminimal
I tried..
in dev it took 2031 ms
in prod it took 8691 ms.
wlminimal
umm. I really want to do it
But my problem is in logged in dashboard.
I don’t know the way to show you :(
OvermindDL1
What is your latency to your heroku server? Like just access a path that doesn’t exist on it and how long does it take to respond 404 from that request?
EDIT: For note, Drab works over Phoenix Channels, it would absolutely not be slow, either the work being done is slow or the network connection is slow.
wlminimal
few seconds, 1 or less
tried this https://www.texty.marketing/non-exist
grych
OMG. 2 seconds on DEV? It is definitely not a problem with latency, but with the complexity of your page! Either you page renders for 2 seconds, or you have a plenty of big assigns on the page.
I suggest two solutions for this:
Drab.Live, as it must re-render the page at every poke you do; useDrab.Elementto update the page insteadOvermindDL1
I figured that would just be from the HTTP request the server makes to that other server they mentioned earlier?
grych
This 2 seconds is just a poke. What poke does is:
OvermindDL1
Oh wait that’s from the server to the client with response back to server (not client to server with response back to client)? That is crazy slow then, I’ve never seen that be slow in dev! (I use a lot of shared commanders though)